Edit Confirm Options

D

Dickie

This might sound a very silly question..

I do NOT want to turn all warnings off, but I have created a Ms Access 2000
app, which will be run from Access Runtime.
One of the options in Access (Tools, Options,Edit/Find) is to remove the
confirm Record Changes & Action Queries. This option is not available when
running the runtime version.
How can these 2 options be disabled via Runtime OR the application.

Thanks in advance for your help
 
A

Arvin Meyer [MVP]

In your code (or macro) turn the warnings off just before you execute the
action query, and turn them back on after you're done:

DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * From MyTable Where ID =" & Me.txtID
DoCmd.SetWarnings True
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
D

Douglas J Steele

You can use DoCmd.SetWarnings False before you run the SQL, and
DoCmd.SetWarnings True after you've run it, or you can use the Execute
method of the DAO Database and QueryDef objects. My vote is always for the
Execute method, since you can trap errors that way.
 
D

Dickie

Thanks for the reply, BUT the number of Queries and Record updates I have
created would really mean me re-programming the whole application, if I used
the Set Warnings Command. IS there no way of running a command which will
basically mimic me Clicking on Tools, Options, Edit/Find and then
de-selecting Confirm Record Changes & Action Queries.
 
G

George Nicholson

The following is the equivalent of unchecking the boxes under Tools>Options:
Application.SetOption "Confirm Record Changes", 0
Application.SetOption "Confirm Action Queries", 0
Application.SetOption "Confirm Document Deletions", 0
Subtitute -1 for zero to turn options back on.

If you weren't using Runtime, I'd suggest using GetOption to store the
user's current setting in a registry key or table before turning the options
off and then restoring the user's setting during app exit routines. Not a
bad idea in any case (never know when users might upgrade to retail...).

HTH,
 
G

Guest

Hi George,
Can I just ask, the code you have written below, whee would I put that?
Would it be setup to run on startup? and how?

many thanks

Simon Reed
 
G

George Nicholson

In the Visual Basic Editor, add a general Module (if you don't have one
already: Insert>Module) and add a new procedure (Insert>Procedure). Let's
call it "StartupRoutine", but you can name it as you wish. Put the code
into that.

Then, in the Access interface, create a Macro. Call it AutoExec (it *must*
be named this). It will consist of one line.
Action: RunCode
Function: StartupRoutine()

As long as the Shift key bypass is not used when opening the file, Access
will automatically run macros named AutoExec, which then runs the code.
This is the only macro in most of my apps.

HTH,
 

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