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



The information in this article applies to:

  • Microsoft Office 2000 Developer
  • Microsoft Access 2000

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

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


Modification Type:MajorLast Reviewed:12/12/2002
Keywords:kbdocfix kbdta kbprb KB205425 kbAudDeveloper