Syntax Error in SQL expression

DB_Queen

New member
Local time
Today, 17:40
Joined
Sep 20, 2021
Messages
22
Hello experts,

I'm attempting to update a record in a table by running a quick SQL statement behind a button a user clicks on a form. For some reason, I'm getting a "syntax error in criteria expression" error on the below. It looks perfectly normal to me and I am stumped as to why I'm getting this error. Any ideas?

DoCmd.RunSQL "UPDATE TABLENAME " _
& "SET FIELDNAME = '" & Me.COMBOBOX & "', FIELDNAME2= False, FIELDNAME3 = "" WHERE TABLENAME.ID = " & Me.txtID & ""
 
Copy and paste the SQL in the query designer to get a hint on the problem from Access.
 
Hi,

I have already tried that, and nothing jumped out at me as an obvious issue 🤷‍♀️
 
Good practice to put it into a string variable and Debug.Print that as well?

Fieldname3= perhaps?
 
Hi,

Here is the specific message I'm getting. It has a problem with the record ID I'm passing.

1650644187679.png
 
As an update, changing the double quotes to single did the trick. Thank you :)
 
As an update, changing the double quotes to single did the trick. Thank you :)
Excellent! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom