SQL statement

  • Thread starter Thread starter Siew-Ming
  • Start date Start date
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
 
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
 
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
 
Back
Top