Supressing Alerts from append and delete queries in macro

DBnub11

Registered User.
Local time
Today, 12:08
Joined
Jan 5, 2011
Messages
26
Hi all


I have a macro running a sequence of append and delete query and i get like 10 alerts through the whole process which is annoying. Anyway I can have Access not show these and turn them off.

Any help much appreciated
 
Look at SetWarnings (don't forget to turn them back on).
 
thanks I got it!!!!
 
(don't forget to turn them back on).

Yup.

I've seriously damaged a database by not doing this as it suppresses things like the "do you want to save changes" messages when closing forms, etc as well as messages relating to the data held in the tables.

Also note, if the macro fails (something severe enough that blocking warning messages does not stop it, importing from a non-existant file, editing data in a table which doesn't exist, etc) before it hits the line that turns the warnings back on you need to be very careful about what you do until you turn them back on.
 
Also note, if the macro fails (something severe enough that blocking warning messages does not stop it, importing from a non-existant file, editing data in a table which doesn't exist, etc) before it hits the line that turns the warnings back on you need to be very careful about what you do until you turn them back on.
...and it might be wise to turn them back on if it fails which you can do in an error handler.

An alternative when performing Updates or Inserts is to use Currentdb.Execute (with the dbFailOnError parameter) which doesn't require turning on/off warnings.
 
Hey vbaInet

can you clarify your last statement on your way of implementing a warning blocker not sure I know what you are talking about
 
I should have mentioned this is in code and not a macro.
Code:
CurrentDb.Execute "UPDATE Table SET [FieldA] = SomeValue WHERE ...",  dbFailOnError
You can read more about this in the Access help files.
 

Users who are viewing this thread

Back
Top Bottom