BerrySkies
BerrySkies

Reputation: 3

Access 2016 - using contents of TextBox in SQL Update command

Receiving error message 'Runtime Error 3061: Too few parameters. Expected 1'

This code fails:

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

inpListName is an unbound TextBox in the form header.

This code works:

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

Code is attached to button onclick in header of form.

Thanks in advance for any help here.

regards Alan

Upvotes: 0

Views: 35

Answers (1)

Sergey S.
Sergey S.

Reputation: 6336

Try this:

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

Upvotes: 1

Related Questions