Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setwarnings false has to be repeated

Status
Not open for further replies.

Niebotel

Programmer
Jan 1, 2007
169
NL
In my coding with a lot of queries I have to set the command: DoCmd.SetWarnings False

before each query; Ohterwise the user gets a lot of mesages to confirm.

Is there a solution to use perhaps another cmd to do it in one step for the complete application?

I'm running the application as accde with runtime access
 
If the queries are all together, then you can just do it like this:
Code:
DoCmd.SetWarnings False
DoCmd.OpenQuery "Query1"
DoCmd.OpenQuery "Query2"
DoCmd.OpenQuery "Query3"
DoCmd.OpenQuery "Query4"
DoCmd.OpenQuery "Query5"
DoCmd.OpenQuery "Query6"
DoCmd.OpenQuery "Query7"
DoCmd.SetWarnings True

But surely you're asking about something altogether different?

I don't know that there is any other way to get around the warnings than to totally shut them off for the time in which you do not need them.

And come to think of it, I think I would add the DoCmd.SetWarnings True line into any error handling as well, so that if the procedure errors out before resetting the messages to true, you're not stuck with the warnings/messages being totally turned off for the whole application. [spineyes]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top