Access 2016 - 在SQL Update命令中使用TextBox的内容

时间:2017-02-05 04:10:36

标签: ms-access

收到错误消息'运行时错误3061:参数太少。预计1'

此代码失败:

dbs.Execute "UPDATE Master " _
    & "SET Selected = -1, tmpListName=Me.inpListName.Value " _
    & "WHERE Active = -1 ; "

inpListName是表单标题中的未绑定TextBox。

此代码有效:

dbs.Execute "UPDATE Master " _
    & "SET Selected = -1, tmpListName='some value' " _
    & "WHERE Active = -1 ; "'

代码附加到按钮onclick in form of header。

提前感谢您的帮助。

问候 艾伦

1 个答案:

答案 0 :(得分:1)

试试这个:

dbs.Execute "UPDATE Master " _
    & "SET Selected = -1, tmpListName='" & Me.inpListName.Value & "' " _
    & "WHERE Active = -1 ; "