Microsoft KB Archive/205425

= MOD2000: How to Change Options for a Custom Application by Using the SetOption Command =

Article ID: 205425

Article Last Modified on 12/12/2002

-

APPLIES TO


 * Microsoft Office 2000 Developer Edition
 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q205425



This article applies only to a Microsoft Access database (.mdb).

Moderate: Requires basic macro, coding, and interoperability skills.



SUMMARY
The Microsoft Office 2000 Developer (MOD) Package and Deployment Wizard does not allow you to include custom registry entries in order to set Access application options for end-users.

This article shows you how to programmatically set several Access options.



MORE INFORMATION
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:   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  Create a macro with the RunCode action that calls the fncSetOptions function as the action argument. 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.

