Insert statement

mays0515

Registered User.
Local time
Yesterday, 18:01
Joined
May 4, 2004
Messages
15
Can someone tell me what is wrong with this statement?

db.execute (INSERT INTO LOOKUP_DATA (current_12_mon) values select sum(current_12_mon) from LOOKUP_DATA);

The error I get is "Syntax Error in INSERT INTO statement"

Thanks,
-mays
 
INSERT is not a VBA Keyword - it is SQL and therefore won't work where you have written it.

However, it is simply fixed. With the db.Execute method, you'll notice that the argument expected is a string. Simply turn it into a string. ;)

Code:
db.execute "INSERT INTO LOOKUP_DATA (current_12_mon) values select sum(current_12_mon) from LOOKUP_DATA;"
 

Users who are viewing this thread

Back
Top Bottom