By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,669 Members | 2,203 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,669 IT Pros & Developers. It's quick & easy.

CurrentProject.Connection.Execute Insert Into

P: n/a
Why does CurrentProject.Connection.Execute "qryStoresImport5ToStage",
RecordsAffected, adCmdText return the error:

Run-time error'-2147217900(80040e14)': Invalid SQL statement; Expected
'DELETE','INSERT','PROCEDURE','SELECT, OR 'UPDATE'.

but

Dim SQL As String
SQL = "INSERT INTO StoresStage ( StoreNumber, StoreName,
StoreAddress1, StoreAddress2, StoreCity, StoreState, StorePostalCode,
StoreCountry, StorePhone, AddressComplete, OpenDate,
ConstructionStatus )SELECT StoresImport.StoreNumber,
StoresImport.StoreName, StoresImport.StoreAddress1,
StoresImport.StoreAddress2, StoresImport.StoreCity,
StoresImport.StoreState, StoresImport.StorePostalCode,
StoresImport.StoreCountry, StoresImport.StorePhone,
StoresImport.AddressComplete, StoresImport.OpenDate,
StoresImport.ConstructionStatus FROM StoresImport WHERE
StoresImport.StoreNumber Is Not Null;"
CurrentProject.Connection.Execute SQL, RecordsAffected, adCmdText

the exact same SQL, works fine?

CurrentProject.Connection.Execute 'Every other query I use',
RecordsAffected, adCmdText also works.
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.