Hello - I'm migrating some VBA code from using docmd.openquery to db.execute. I got this code from an example on the web:
Dim db As DAO.Database
Set db = CurrentDb()
db.Execute "COM_CREATE_COMMISSIONS", dbFailOnError
db.Execute "COM_CREATE_COMMISSIONS_GM", dbFailOnError
db.Execute "COM_CREATE_COMMISSIONS_REV", dbFailOnError
The three queries (in quotes) are append queries, and when running I get the error above "Runtime error 3061': Too few parameters. Expected 4. I have tried quite a few permutations but this error seems to be the closest to actually running the code, so this is the example I'm posting hear. The three queries run fine (and ran fine using the docmd.openquery code), and they are in an Access 2013 database. The code did have some problems before I referenced the "Microsoft Office 15.0 Access database engine Object Library" and "Microsoft Data Access Components Installed Version", which seemed to fix that problem.
In summary, I'm just looking for the complete syntax for using the db.execute statement to run three already defined Access 2013 queries.
Note - this is my workaround for suppressing Action Query messages, since it's the only published method to do so when using SharePoint Lists as the data source (which is the case for the queries in this case). The Action Query confirmations remained even though they were turned off in Client Options, the autoexec macro, and even in the code. So a solution to completely turn off these confirmations (when using SharePoint Lists) during an action query would also be equally effective for me, as I can simply use the docmd.openquery syntax.