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.