Disabling "Confirm Record Changes" programmatically

J

John S. Ford, MD

I have an application running in Access 2000 with a form that enables the
user to delete records through my own code. I'd like to be able to turn off
the confirmation warnings for record changes programmatically and then turn
them back on again as my user is exiting the application. (I'm handling the
confirmation warnings myself through my own code.)

I know how to do it through the Tools-->Options-->Edit/Find menu but I want
to be able to do it through my code. Any ideas?

John
 
F

fredg

I have an application running in Access 2000 with a form that enables the
user to delete records through my own code. I'd like to be able to turn off
the confirmation warnings for record changes programmatically and then turn
them back on again as my user is exiting the application. (I'm handling the
confirmation warnings myself through my own code.)

I know how to do it through the Tools-->Options-->Edit/Find menu but I want
to be able to do it through my code. Any ideas?

John

To turn off the warning each time you run an Action query, use:
DoCmd.SetWarnings False
DoCmd.OpenQuery "ActionQueryName"
DoCmd.SetWarnings True


To turn off warnings in the Options for the entire session of Access,
look up the SetOption method in VBA Help.
Also see the "Set options from Visual Basic" for the string needed.

Turning warnings off completely may have unintended consequences.
 
D

Douglas J. Steele

DoCmd.SetWarnings False before, DoCmd.SetWarnings True after.

But how are you deleting the records? If you're using SQL, then look into
using the Execute method of the DAO Database or QueryDef objects. Not only
does that not display the warnings, but it also will generate a trappable
error if something goes wrong running the SQL.
 

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