Append query in code

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
 
R

Roger Carlson

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?
 
G

Guest

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.
 

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