Run DELETE queries at same time

  • Thread starter Thread starter MikeF
  • Start date Start date
M

MikeF

As am building a database w/test data, have 7 delete queries that I'd like
to run at the same time, as opposed to picking thru them individually.

Call them qryDelete1 thru qryDelete7.

Does anyone know how to "gang" them together?

Thanx,
-Mike
 
One option you have is to set up a macro that calls all the delete queries
in a row..

I have several delete queries that I need to run to delete all records from
all tables so I can import the new data.
Calling them from one macro works like a charm.
 
As am building a database w/test data, have 7 delete queries that I'd like
to run at the same time, as opposed to picking thru them individually.

Call them qryDelete1 thru qryDelete7.

Does anyone know how to "gang" them together?

Thanx,
-Mike

You can use code to run one query after the other.

If just a few queries (7) :

Public Sub RunQueries()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryDelete1"
DoEvents
DoCmd.OpenQuery "qryDelete2"
DoEvents
........
DoCmd.OpenQuery "qryDelete7"
DoCmd.SetWarnings True
End Sub

Or... if you want, you could use a For .. Next loop to cycle through
the queries (as long as they are named in numerical order i.e.
"qryDelete1", "qryDelete2" etc..


Dim intX as Integer
DoCmd.SetWarnings False
For intX = 1 to 7
DoCmd.OpenQuery "qryDelete" & intX
DoEvents
Next intX
DoCmd.SetWarnings True
 
Back
Top