This article shows you how to programmatically set the following three Access options:
� | Confirm action queries |
� | Confirm document deletions |
� | Confirm record changes |
To view these options within the Access 2000 user interface, open any database. On the
Tools menu, click
Options. In the
Options dialog box, click the
Edit/Find tab, and note the
Confirm options in the upper-right corner. To change these and other Access options programmatically, you must use the
SetOption method of the
Application object.
The
SetOption method updates the value of the Access application options stored in the registry. For example, the registry location for the
Confirm Action Queries option is located at:
HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Access\Settings
To change the settings in a database environment to ensure that the user is prompted to confirm action queries, document deletions, and record changes, do the following:
1. | In your application, create a new module. Type or paste the following code:
Option Compare Database
Option Explicit
Function fncSetOptions()
Application.SetOption "Confirm Action Queries", True
Application.SetOption "Confirm Document Deletions", True
Application.SetOption "Confirm Record Changes", True
End Function
|
2. | Create a macro with the RunCode action that calls the fncSetOptions function as the action argument. |
3. | Save the macro as Autoexec so that it runs when the database is opened. This ensures that the options are set to the preferred settings each time that the database is opened. |