Pausing Code

J

JimP

I have a number of append queries that I want to run in successive order.
How can I force the first query to complete execution before the 2nd one
starts, etc.?
 
A

Allen Browne

Use the Execute method. It will complete the first before running the next.

Example code:
dim db As DAO.Database
Set db = CurrentDb
db.Execute "Query1", dbFailOnError
db.Execute "Query2", dbFailOnError
'etc
Set db = Nothing

If you need more information, and comparison with RunSQL, see:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
 
J

JimP

Thank you,

Allen Browne said:
Use the Execute method. It will complete the first before running the
next.

Example code:
dim db As DAO.Database
Set db = CurrentDb
db.Execute "Query1", dbFailOnError
db.Execute "Query2", dbFailOnError
'etc
Set db = Nothing

If you need more information, and comparison with RunSQL, see:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
 
Top