Turning Confirmation Messages On/Off

P

pareez

Is there anyway to turn confirmation messages for record changes, action
queries and document deletions off at the database level? Instead of going
to the Tools menu and then selecting Options on each PC that accesses the
database, is there anyway to program it into the database, so no matter what
PC is it's accessed from, confirmation messages are turned off?
 
F

Fred Boer

Dear pareez:

This can be done in code, but most people would advise you not to do it!
This change would affect all databases, not just yours. Your user would be
justifiably annoyed to find that this setting is being changed behind their
back. You can set this in code using the Application.SetOption method. For
example, in OnOpen Event of the first form of your application, you could
have the following, which sets an option for keyboard behaviour:

Application.SetOption "Behavior Entering Field", 1

You can set all kinds of options this way; there is a table in VBA help.
(Index: SetOptions; Topic "Set options from Visual Basic")

So... :

Application.SetOption "Confirm record changes", False
Application.SetOption "Confirm action queries", False

You could take the trouble to identify the current setting of this property
on opening the application, store this setting, change it for the purposes
of your application and re-set to the original setting before closing the
application, but if the application doesn't close properly, your "resetting"
code might not work.

An alternative would be to use "DoCmd.SetWarnings False" before running code
that will make changes, and then place "DoCmd.SetWarnings True" after the
changes have been made. This won't affect the application, but will prevent
the confirmation messages.

HTH
Fred Boer
 
A

Allen Browne

Fred has answered the specific questions you asked.

If this is for append, delete, update or make table queries, and you want
another alternative to turning SetWarnings off, see:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top