SQL statement

S

Siew-Ming

Hi,

What is wrong in this SQL statement if I need to run thru VBA where the YEAR
field is a numeric field? I got error a run time error 3144. Syntax error
in Update statement.

strSQL = "UPDATE [" & tblFirst & "] as A SET [A]![YEAR] = 2009 WHERE
[A]![YEAR] = 2008;"
db.Execute strSQL, dbFailOnError

Thanks,
Sming
 
J

John Spencer MVP

strSQL = "UPDATE [" & tblFirst & "] as A SET [A].[YEAR] = 2009 WHERE
[A].[YEAR] = 2008;"

If that fails or generates an error, check the value of tblFirst and see what
it is. Is it a valid existing table name?

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
S

Siew-Ming

That was it. Thank you so much for your troubleshooting.

Sming


John Spencer MVP said:
strSQL = "UPDATE [" & tblFirst & "] as A SET [A].[YEAR] = 2009 WHERE
[A].[YEAR] = 2008;"

If that fails or generates an error, check the value of tblFirst and see what
it is. Is it a valid existing table name?

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Siew-Ming said:
Hi,

What is wrong in this SQL statement if I need to run thru VBA where the YEAR
field is a numeric field? I got error a run time error 3144. Syntax error
in Update statement.

strSQL = "UPDATE [" & tblFirst & "] as A SET [A]![YEAR] = 2009 WHERE
[A]![YEAR] = 2008;"
db.Execute strSQL, dbFailOnError

Thanks,
Sming
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top