Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to run existing action query from VBA Module

Status
Not open for further replies.

mb22

Programmer
Sep 4, 2002
258
US
I have several queries already defined. I am able to playback all the action queries using a simple autoexec Macro.

However I wish to run or execute these queries in a Module, so that I can do more .. like Error checking or creating a text file of the success or time it took to run.

Problem is I tried
DoCmd.OpenQuery
but it appears to be needing a form parameter.......

DoCmd.RunSQL
but then it appears I have to retype the whole syntax for the query again

..Does anyone have a simple code example to just execute the action query in the VBA module without retyping it ..since all the queries are already predefined.

say my action queries are called

qry1 (creates new table)
qry2 (inserts records)
 
If I understand what you are asking

docmd.setwarnings false
docmd.openquery "qry1"
docmd.openquery "qry2"
docmd.setwarnings true
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top