SQL statement to append records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everybody,

I'm trying to use an sql statement in VB to append records from on table to
another.
"INSERT INTO tmpCustomers (ID, name) " & _
"SELECT customers.code, customers.name FROM Customers"

When i use de runSQL method i get run-time error 3129 - (invalid statement)

I guess something's wrong in that statement. Can anyone help?

Thanks,

N. Cabaco
 
Jet may be confused by your use of Name as a field name. Try this:

"INSERT INTO tmpCustomers (ID, [name]) " & _
"SELECT customers.code, customers.[name] FROM Customers"

Do not use Name as the name of a field. It and many other words are reserved
words in ACCESS, and can create serious confusion for ACCESS and Jet. See
these Knowledge Base articles for more information:

List of reserved words in Access 2002 and Access 2003
http://support.microsoft.com/default.aspx?scid=kb;en-us;286335

List of Microsoft Jet 4.0 reserved words
http://support.microsoft.com/?id=321266

Special characters that you must avoid when you work with Access
databases
http://support.microsoft.com/?id=826763
 
Back
Top