append query alerts

chr1stoper1

Registered User.
Local time
Yesterday, 16:07
Joined
Mar 29, 2015
Messages
17
Hi Guys

I have an excel sheet which I use to populate 3 different tables in 3 databases by using append queries . Recently I had to change my pc and since then before it will append flags an alert telling me it it is about to append and do I want to continue .It does this for each append . Is there a way of turning these off?
Thanks for any help
 
Its possible to switch off the warnings permanently from Database Options BUT I strongly advise against doing that

Instead do one of the following

Add these lines before and after you run your query
Code:
DoCmd.SetWarnings False
DoCmd.OpenQuery "YourQueryName"
DoCmd.SetWarnings True

Or replace this line
Code:
DoCmd.OpenQuery "YourQueryName"
with this line
Code:
CurrentDB.Execute "YourQueryName"

This will work equally well with SQL statements instead of queries
 
Using the .execute method is usually preferable but if you stick with .OpenQuery, it is IMPERATIVE that you always turn warnings back on after you turn them off. If you don't, you will eventually pay the price. With warnings off, if you close an object you have modified, Access will simply assume you know what you are doing and silently discard any changes you made and then save the object. With warnings on, Access will always remind you to save first.

To get around the problem, I created two macros (the ONLY macros in my applications). One macro turns warnings off and the hourglass on and the other turns warnings on and the hourglass off. With the hourglass as a reminder that warnings are off, you won't accidentally forget that warnings are off since the hourglass is too annoying. Then you can simply run the on macro to turn warnings on and the hourglass off.
 

Users who are viewing this thread

Back
Top Bottom