Table of contents
TOC
Collapse the table of content
Expand the table of content

Application.SetOption Method (Access)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

The SetOption method sets the current value of an option in the Access Options dialog box.

Syntax

expression. SetOption( ** OptionName, ** Setting )

expression A variable that represents an Application object.

Parameters

NameRequired/OptionalData TypeDescription
OptionNameRequiredStringThe name of the option. For a list of optionname argument strings, see Set Options from Visual Basic.
SettingRequiredVariantA value corresponding to the option setting. The value of the setting argument depends on the possible settings for a particular option.

Remarks

The available option settings depend on the type of option being set. There are three general types of options:

  • Yes/No options that can be set by selecting or clearing a check box.

  • Options that can be set by entering a string or numeric value.

  • Predefined options that can be chosen from a list box, combo box, or option group.

For options that the user sets by selecting or clearing a check box, using the SetOption method, specify True or False for the setting argument, as in the following example:

Application.SetOption "Show Status Bar", True

To set a type of option using the SetOption method, specify the string or numeric value that would be typed in the dialog box. The following example sets the default form template to OrderTemplate:

Application.SetOption "Form Template", "OrderTemplate"

For options with settings that are choices in list boxes or combo boxes, specify the option's numeric position within the list as the setting argument for the SetOption method. The following example sets the Default Field Type option to AutoNumber:

Application.SetOption "Default Field Type", 5

To set an option that's a member of an option group, specify the index number of the option within the group. The following example sets Selection Behavior to Fully Enclosed:

Application.SetOption "Selection Behavior", 1
Note
When you quit Microsoft Access, you can reset all options to their original settings by using the SetOption method on all changed options. You may want to create public variables to store the values of the original settings. You might include code to reset options in the Close event procedure for a form, or in a custom exit procedure that the user must run to quit the application.

See also

Concepts

Application Object

© 2018 Microsoft