Append query in code

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

Guest

Hi - I have Access 2002 and I am getting an error when I try to run an append query in code. Just running the query itself works but when I try to execute it from code, I get the error "invalid sql statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. The query works fine outside of the code but not from within the code. Can anybody help
 
Without seeing the code, how can we tell?

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

Becky said:
Hi - I have Access 2002 and I am getting an error when I try to run an
append query in code. Just running the query itself works but when I try to
execute it from code, I get the error "invalid sql statement; expected
'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. The query works
fine outside of the code but not from within the code. Can anybody help?
 
Here's the code

Dim cmd As ADODB.Comman

Set cmd = New ADODB.Comman
cmd.ActiveConnection = CurrentProject.Connectio
cmd.CommandText = "qry_cl_sum"
cmd.Execut

Like I said previous, the query works outside of the VBA code perfectly fine, but I get the Invalid SQL string when executing it in the code. All the query is doing is grouping by a bunch of fields and summing by a few others and then appending to a table
Thanks.
 
Back
Top