Solved Incorrect Syntax for SQL UPDATE Statment (1 Viewer)

Ryan142

Member
Local time
Today, 00:30
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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:30
Joined
Oct 29, 2018
Messages
21,467
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.
 

Ryan142

Member
Local time
Today, 00:30
Joined
May 12, 2020
Messages
52
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

Top Bottom