Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


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:
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.

↑ Back to the top


References

For more information about programmatically setting the options for the Application object, click Microsoft Visual Basic Help on the Help menu, type application setoption in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

For additional information on the Package and Deployment Wizard, click the article number below to view the article in the Microsoft Knowledge Base:
240956 MOD2000: Package and Deployment Wizard Now Used to Create a Distributable Application
For additional information about programmatically editing the registry, click the article number below to view the article in the Microsoft Knowledge Base:
145679 HOWTO: Use the Registry API to Save and Retrieve Setting

↑ Back to the top


Keywords: KB205425, kbprb, kbdta, kbdocfix

↑ Back to the top

Article Info
Article ID : 205425
Revision : 1
Created on : 12/12/2002
Published on : 12/12/2002
Exists online : False
Views : 413