Removing message boxes associated with append queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to remove the message box that access pops up when running a append query. The message that states "you are about to run a query that will modify records in one or more tables" and the message box that follows "this will append XX records to a Table". I am using a macro to run a string of queries and do not want to have to press through all the message boxes ...

Please help someon
 
Is there a way to remove the message box that access pops up when
running a append query. The message that states "you are about to
run a query that will modify records in one or more tables" and the
message box that follows "this will append XX records to a Table".
I am using a macro to run a string of queries and do not want to
have to press through all the message boxes ....

Please help someone

Precede the OpenQuery macro with a SetWarnings False macro then
follow it with a SetWarnings True macro.

It is more efficient to use an event Sub Procedure (rather than 3
macros) to do this:

DoCmd.SetWarnings False
DoCmd.OpenQuery "QueryName"
DoCmd.SetWarnings True
 
Thank you fred,

woudl I need to put this sub procedure in the query's code? I would
much rather use the code, than have to precede then follow all the
queries with another macro. Thank you for the assistance.

Barry

No.
A sub procedure would replace the use of the macro that opens the
query. It is not part of the query.

How to write an event sub-procedure?

*** NOTE: This will be instead of your OpenQuery macro !!!!!! ***

Display the property sheet. Click on the Event Tab. Click on the
event line you wish to use. Write:
[Event Procedure]
on that line.
Then click on the little button with the 3 dots that appears on that
line. When the event code window opens, the cursor will appear
between 2 already existing lines.
Place the following code BETWEEN those 2 lines:

DoCmd.SetWarnings False
DoCmd.OpenQuery "QueryName"
DoCmd.SetWarningsTrue

Exit the code window.

This should be done for each action query you run from code.
It will not work if you run the query directly from the Main Application window.

Alternatively, you could set the Database Options to turn off all warnings
Tools + Options + Edit/Find
Remove the check mark from Confirm Action Queries.

This is not advisable. Warnings serve a useful purpose.
There may be a time when you need to display the warning and you
will not remember that they are turned off.
 
Thank you very much Fred You are The man!!
OK I have one more question, how I can I make a custom message box appear after the string of queries has run?

If you can advise I would appriciate, I thank you again for time and help on this previous matter.

Barry

Barry,
There is an old joke "How do I get to Carnegie Hall?"*

Well, to answer, you have to know where I am, when I want to leave,
how much I am willing to spend, etc.
Get the idea?
You have asked a question, but given absolutely no details.
"the string of queries has run?" How are you running the queries, one
at a time? By code from an event or using one macro or several macros?

"a custom message box"? And the message is....????

*Of course the way for any one of us to get to Carnegie Hall, no
matter where we are, is to practice.. practice.. practice! <g>
 
Back
Top