Discussion Locked

Access 97 Runtime - controlling options

0 helpful
13 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I generated a runtime version of a database, and when it is installed, all the Action Queries request confirmation. That option is not checked in Options on my system. How do you turn it off in the runtime version. If need VBA code, what is the code?

13 replies

by kempj

If you are calling the action query in a macro or in vb then you can turn off messages either by using the command SetWarnings in the macro before running the action query or using an equivalent in vb
Hope this helps

by irishtlr

You can also include YOUR system.mdw file in your distribution. This stores whether confirmations are on or not

by crowmoor

If you just dubbelklick on an actionquery then its more difficult but if you run them from a form just add the following code to the clickevent on your button (or the event that you use)

DoCmd.SetWarnings False 'turns warnings off

(your code here eg DoCmd.OpenQuery "QueryName"
DoCmd.OpenReport "ReportName")

DoCmd.SetWarnings True 'turns warnings on

If you use Macro then include
SetWarnings with parameter False first and
parameter True Last.

If you have more questions then feel fre to mail me.

Jesper Kr?khede

by mcorr

The best answer to this is to set the program options the way you want them when the program starts. Then if you are nice you set them back the way they were when you started.

1. Declare globals (in a module) to hold the initial states of the options.
Public OPTIONRecChanges As Variant
Public OPTIONActionQueries As Variant

2. Read initial values in FormOpen of first form (splash, switchboard, etc.)
' Get the options for this location
OPTIONRecChanges = Application.GetOption("Confirm Record Changes")
OPTIONActionQueries = Application.GetOption("Confirm Action Queries")

3. Set desired values in same event as #2.
' Now set the confirm options off
Application.SetOption "Confirm Record Changes", False
Application.SetOption "Confirm Action Queries", False

4. Make a close program event that the switchboard or other form calls to close. Reset the initial values found in #2.
' Set the confirm options to their state when started.
Application.SetOption "Confirm Rec

by mickfranzen

Get the SQL script for the query (You may already have it)

run theis piece of code (short an simple)

Dim dbsdb as database
set dbsdb = currentdb
dbsdb.execute (SQL)

And query will run

by acwiz

Not a good idea to leave warnings off all the time. Here are two sub's I use where I need to turn the warnings and hourglass on and off

Sub HgOffWarnOn()
On Error GoTo HgOffWarnOn_ERR
DoCmd.SetWarnings True
DoCmd.Hourglass False
ExitSub

HgOffWarnOn_ERR:
MsgBox "An error has occurred.: " & Error$
Resume Next
End Sub

Sub HgOnWarnOff()
On Error GoTo HgOnWarnOff_ERR
DoCmd.SetWarnings False
DoCmd.Hourglass True
Exit Sub

HgOnWarnOff_ERR:
MsgBox "An error has occurred.: " & Error$
Resume Next
End Sub

This discussion is closed to new replies.