SQL Syntax Error in UPDATE command.

NJDubois

Well-known member
Joined
May 15, 2008
Messages
84
Programming Experience
Beginner
I'm writing a Database program and using MS Access with SQL statements doing the dirty work. I have reading, adding new records and deleting records done working, and awesome. But when it comes time to update payment info I have a problem.

This SQL statement works :
UPDATE Books SET Camper_Last='Doe',Camper_First='JOHN' WHERE Camper_Last='Doe' AND Camper_First='John' AND Event_Year='2010'

Where this one gives me an SQL Syntax Error:
UPDATE Books SET Final Event Cost='0' WHERE Camper_Last='Doe' AND Camper_First='John' AND Event_Year='2010'

I know everything before SET and after WHERE is ok, Final Event Cost is a Text Field of unlimited length. I slept on it and think its the spaces in the field name, but I'm hours away from being able to open it up and try that out, so in the mean time I wanted to post here just to make sure it wasn't anything else.

Any input is much appreciated, vbdotnetforums is where I have gone from the start. Love this place and have got many helpful responses in the past. Thanks for any help and I hope your having a good day!

Nick
 
Thanks!

your the best, the hard brackets did the trick. Many, many many MANY thanks.

As I said, this is the only place I'll come with my questions.

Again, thanks

Nick
 
do not put spaces in column names
EitherNameThemLikeThis
or_name_them_like_this

This is a general advice for all database systems; putting spaces or other weird characters in column names can only lead to headaches

Also, do not use reserved words (anything that appears in a programming language syntax) as column names
 
Back
Top