Automatic acceptance of append querry in macro

  • Thread starter Thread starter AJ Raiber
  • Start date Start date
A

AJ Raiber

Hello!

I have a macro that is designed to run a series of queries
to identify and append information from one table to
another and then delete the information from the first
table. The set up is this:

Record 8 in tblA meets the criteria. So, when the macro
runs it first opens the append querry "qryappend" in
design view. This query pulls based on the desired
criteria, selects record 8 and appends it to tblB. The
next command runs the query with the RunCommand feature.
Then the macro closes qryappend. Next the macro
opens "qrydelete" , a delete query which uses the same
criteria as qryappend, in datasheet view which deletes
record 8 from tblA. The Macro then closes qrydelete.

The issue here is that when this runs I get a series of
pop-up windows which ask me if I really want to run the
append query and then if I want to append the rows and
then if I want to run the delete query and then if I want
to delete the rows. The answer to each of these will
always be yes. Is there a way to make the system
automatically choose yes on these items? If not in the
Macro can I do this through VBA?

Thank you!
 
AJ,

First of all, unless I am missing your meaning, opening the queries in
design view does not achieve anything. You can just run both the append
query and the delete query using an OpenQuery action for each, and
that's it! If you put a SetWarnings,No action in the macro before the
first OpenQuery action, this will suppress the display of the
confirmation messages.
 
Steve,

Thank you for the help. It worked like a charm. I
followed the work of a previous boss of mine to make this
macro and this was the way he built it. I assume that he
may have been debugging it at some point to open it in
design view and the use the "Run" command to make it
work. I have simplified it now.

Thanks again.

AJ
 
Back
Top