Running Apend,Delete and Make queries with VB

A

Aaron

I have a macro that I run 4 difference query updates with.

qrydeleteopencounts (Delete Query)
qryMakeTableCYCDATECOPY (Make Table Query)
qryAppendProductionMSList (Append Query)
qryAppendFGList (Append Query)

Is there a easier why to do this so I do not have the click "Yes" a dozen
times while running this macro?

Thanks,
Aaron
 
D

Dirk Goldgar

Aaron said:
I have a macro that I run 4 difference query updates with.

qrydeleteopencounts (Delete Query)
qryMakeTableCYCDATECOPY (Make Table Query)
qryAppendProductionMSList (Append Query)
qryAppendFGList (Append Query)

Is there a easier why to do this so I do not have the click "Yes" a dozen
times while running this macro?


So you have a macro that uses the OpenQuery action 4 times? How do you get
a dozen confirmation dialogs? You can use the SetWarnings action to turn
off warnings before your first OpenQuery, and then use SetWarnings to turn
them on again after the last OpenQuery. Note: I believe warnings are
automatically turned on again at the end of an executing macro -- unlike
what happens in VBA code -- but it's a good practice to make *sure* you
always turn them on again after you've turned them off.

If it were me, I would do this process via VBA code instead of a macro,
because that provides a better way of running the action queries without
getting any confirmation dialogs.
 
M

Marshall Barton

Aaron said:
I have a macro that I run 4 difference query updates with.

qrydeleteopencounts (Delete Query)
qryMakeTableCYCDATECOPY (Make Table Query)
qryAppendProductionMSList (Append Query)
qryAppendFGList (Append Query)

Is there a easier why to do this so I do not have the click "Yes" a dozen
times while running this macro?

Use the Execute method:

Dim db As Database
Set db = CurrentDb()
db.Execute qrydeleteopencounts, dbFailOnError
, , ,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top