Update Query End Of Statement Error

GendoPose

Registered User.
Local time
Today, 10:46
Joined
Nov 18, 2013
Messages
175
Hi All,

I'm trying to write an UPDATE line in VBA, but whenever I put the table name I get an "Expected End of Statement" error.

This is line currently;

Code:
strSQL = UPDATE "MASTER PLANNER" SET [SET 2] = TRUE WHERE "[ID] = " & Me.PlannerID
It doesn't matter whether I change the table name to square brackets, quotes or nothing at all, it always gives me the expected end of statement error. I can't figure out for the life of me what I'm doing wrong here.

Any thoughts?

Thanks!
 
The entire statement starting by Update ending at = needs to be a string like so
Code:
strSQL = "UPDATE [MASTER PLANNER] SET [SET 2] = TRUE WHERE [ID] = " & Me.PlannerID

Note 1: using spaces in names is a bad idea, it can and will cause your problems.
Use underscores or capitols instead Master_planner or MasterPlanner

Note 2: set 2, as in set 1, 2,3,4,5? having numbered column names generally is a sign of bad design.
 
The entire statement starting by Update ending at = needs to be a string like so
Code:
strSQL = "UPDATE [MASTER PLANNER] SET [SET 2] = TRUE WHERE [ID] = " & Me.PlannerID
Note 1: using spaces in names is a bad idea, it can and will cause your problems.
Use underscores or capitols instead Master_planner or MasterPlanner

Note 2: set 2, as in set 1, 2,3,4,5? having numbered column names generally is a sign of bad design.

Nice one, cheers mate! Yeah I know there's some bad naming conventions, unfortunately I inherited this database when I got promoted and it's not exactly been designed well...
 

Users who are viewing this thread

Back
Top Bottom