Removing Action query prompts

WSC

Registered User.
Local time
Today, 15:45
Joined
Nov 16, 2006
Messages
19
I am creating an Event Procedure on the click of a form button that is going to execute a Delete Action Query. When I click the button, it works properly but prompts for you to OK the deletion. Is there a way in VBA in the event procedure that I can set the prompts to always be accepted?
 
Just before your line telling the code to delete, add

DoCmd.SetWarnings False

but remember to set it back to

DoCmd.SetWarnings True

afterwards, or you'll never get warned.
 
Thanks

Thank you SO much! That worked, and it is so simple!
 
Make sure you always reset to true right after your items you need to have it turned off for. Otherwise, it won't warn you EVER for anything and if you modify code, forms, etc. it won't warn you if you make changes and then forget to save. It will just close without saving.

I always put the set true part in the error handling for any event I've disabled the warnings as it prevents problems where something glitches in the code between the set warnings and will reset them after an error, otherwise you may find yourself without any warnings at all.
 
I did that, I set warnings to False, ran the two delete queries I needed to run, and immediately after that set the warnings to true.

Thanks!
 
Just in case it didn't "gel" as I'm not sure it did from your response - Make sure to put in Error Handling and then put the SetWarnings True in the Error Handling TOO so that if something glitches during your queries, you won't be hung out to dry, so-to-speak. Because if it never gets to your SetWarnings True code, you will quickly find yourself without any warnings (as I have experienced in the past and why I emphasize that).
 

Users who are viewing this thread

Back
Top Bottom