Solved Incorrect Syntax for SQL UPDATE Statment

Ryan142

Member
Local time
Today, 18:43
Joined
May 12, 2020
Messages
52
Hi guys,

I posted yesterday about incorrect syntax again for an update statement, however I've got a new error with a different line of code. I just copy and pasted it from this

Code:
"UPDATE tblUserLogins SET Password = '" & Me.txtNewPass1 & "' WHERE LoginID = " & LoginID

and transferred it to this

Code:
"UPDATE tblAircraftDetails SET Registration = '" & Me.txtRegistration & "' WHERE AircraftID = " & ID

When I run this code however with Currentdb.Execute(), it returns an error saying " Syntax error (missing operator) in query expression "AircraftID ='. "

Any help is greatly appreciated!

Thanks, Ryan
 
Hi Ryan. It means there is no value for ID. To avoid the error, you could try using the Nz() function. For example. ... & Nz(ID,0)

However, you should probably find out why there's no value for ID.
 
Hi Ryan. It means there is no value for ID. To avoid the error, you could try using the Nz() function. For example. ... & Nz(ID,0)

However, you should probably find out why there's no value for ID.

Great thanks for the pointer I'll take a look
 

Users who are viewing this thread

Back
Top Bottom