Set Options from Visual Basic [Access 2003 VBA Language Reference]

You can use the SetOption and GetOption methods to set and return option values in the Options dialog box from code. To view the Options dialog box, click Options on the Tools menu.

The following tables list the names of all options that can be set or returned from code and the tabs on which they can be found in the Options dialog box, followed by the corresponding string argument that you must pass to the SetOption or GetOption method.

Notes

If your database may run on a version of Microsoft Access for a language other than the one in which you created it, then you must supply the arguments for the GetOption and SetOption methods in English.

Some options are available only within a Microsoft Access database (.mdb) or Access project (.adp).

View Tab

Option text String argument
Show, Status bar Show Status Bar
Show, Startup Task Pane Show Startup Dialog Box
Show, New object shortcuts Show New Object Shortcuts
Show, Hidden objects Show Hidden Objects
Show, System objects Show System Objects
Show, Windows in Taskbar ShowWindowsInTaskbar
Show in Macro Design, Names column Show Macro Names Column
Show in Macro Design, Conditions column Show Conditions Column
Click options in database window Database Explorer Click Behavior

General Tab

Option text String argument
Print margins, Left margin Left Margin
Print margins, Right margin Right Margin
Print margins, Top margin Top Margin
Print margins, Bottom margin Bottom Margin
Use four-year digit year formatting, This database Four-Digit Year Formatting
Use four-year digit year formatting, All databases Four-Digit Year Formatting All Databases
Name AutoCorrect, Track name AutoCorrect info Track Name AutoCorrect Info
Name AutoCorrect, Perform name AutoCorrect Perform Name AutoCorrect
Name AutoCorrect, Log name AutoCorrect changes Log Name AutoCorrect Changes
Recently used file list Enable MRU File List
Recently used file list, (number of files) Size of MRU File List
Provide feedback with sound Provide Feedback with Sound
Compact on Close Auto Compact
New database sort order New Database Sort Order
Remove personal information from file properties on save Remove Personal Information
Default database folder Default Database Directory

Edit/Find Tab

Option text String argument
Default find/replace behavior Default Find/Replace Behavior
Confirm, Record changes Confirm Record Changes
Confirm, Document deletions Confirm Document Deletions
Confirm, Action queries Confirm Action Queries
Show list of values in, Local indexed fields Show Values in Indexed
Show list of values in, Local nonindexed fields Show Values in Non-Indexed
Show list of values in, ODBC fields Show Values in Remote
Show list of values in, Records in local snapshot Show Values in Snapshot
Show list of values in, Records at server Show Values in Server
Don't display lists where more than this number of records read Show Values Limit

Datasheet Tab

Option text String argument
Default colors, Font Default Font Color
Default colors, Background Default Background Color
Default colors, Gridlines Default Gridlines Color
Default gridlines showing, Horizontal Default Gridlines Horizontal
Default gridlines showing, Vertical Default Gridlines Vertical
Default column width Default Column Width
Default font, Font Default Font Name
Default font, Weight Default Font Weight
Default font, Size Default Font Size
Default font, Underline Default Font Underline
Default font, Italic Default Font Italic
Default cell effect Default Cell Effect
Show animations Show Animations
Show Smart Tags on Datasheets Show Smart Tags on Datasheets

Keyboard Tab

Option text String argument
Move after enter Move After Enter
Behavior entering field Behavior Entering Field
Arrow key behavior Arrow Key Behavior
Cursor stops at first/last field Cursor Stops at First/Last Field
Auto commit Ime Autocommit
Datasheet IME control Datasheet Ime Control

Tables/Queries Tab

Option text String argument
Table design, Default field sizes - Text Default Text Field Size
Table design, Default field sizes - Number Default Number Field Size
Table design, Default field type Default Field Type
Table design, AutoIndex on Import/Create AutoIndex on Import/Create
Query design, Show table names Show Table Names
Query design, Output all fields Output All Fields
Query design, Enable AutoJoin Enable AutoJoin
Query design, Run permissions Run Permissions
Query design, SQL Server Compatible Syntax (ANSI 92) - This database ANSI Query Mode
Query design, SQL Server Compatible Syntax (ANSI 92) - Default for new databases ANSI Query Mode Default
Query design, Query design font, Font Query Design Font Name
Query design, Query design font, Size Query Design Font Size
Show Property Update Options buttons Show Property Update Options buttons

Forms/Reports Tab

Option text String argument
Selection behavior Selection Behavior
Form template Form Template
Report template Report Template
Always use event procedures Always Use Event Procedures
Show Smart Tags on Forms Show Smart Tags on Forms
Show Windows Themed Controls on Forms Themed Form Controls

Advanced Tab

Option text String argument
DDE operations, Ignore DDE requests Ignore DDE Requests
DDE operations, Enable DDE refresh Enable DDE Refresh
Default File Format Default File Format
Default open mode Default Open Mode for Databases
Command-line arguments Command-Line Arguments
OLE/DDE timeout (sec) OLE/DDE Timeout (sec)
Default record locking Default Record Locking
Refresh interval (sec) Refresh Interval (sec)
Number of update retries Number of Update Retries
ODBC refresh interval (sec) ODBC Refresh Interval (sec)
Update retry interval (msec) Update Retry Interval (msec)
Open databases using record-level locking Use Row Level Locking

Pages Tab

Option text String argument
Default Designer Properties, Section Indent Section Indent
Default Designer Properties, Alternate Row Color Alternate Row Color
Default Designer Properties, Caption Section Style Caption Section Style
Default Designer Properties, Footer Section Style Footer Section Style
Default Database/Project Properties, Use Default Page Folder Use Default Page Folder
Default Database/Project Properties, Default Page Folder Default Page Folder
Default Database/Project Properties, Use Default Connection File Use Default Connection File
Default Database/Project Properties, Default Connection File Default Connection File

Spelling Tab

Option text String argument
Dictionary Language Spelling dictionary language
Add words to Spelling add words to
Suggest from main dictionary only Spelling suggest from main dictionary only
Ignore words in UPPERCASE Spelling ignore words in UPPERCASE
Ignore words with numbers Spelling ignore words with number
Ignore Internet and file addresses Spelling ignore Internet and file addresses
Language-specific, German: Use post-reform rules Spelling use German post-reform rules
Language-specific, Korean: Combine aux verb/adj. Spelling combine aux verb/adj
Language-specific, Korean: Search misused word list Spelling use auto-change list
Language-specific, Korean: Process compound nouns Spelling process compound nouns
Language-specific, Hebrew modes Spelling Hebrew modes
Language-specific, Arabic modes Spelling Arabic modes

International Tab

Option text String argument
Right-to-Left, Default direction Default direction
Right-to-Left, General alignment General alignment
Right-to-Left, Cursor movement Cursor movement
Use Hijri Calendar Use Hijri Calendar

Error Checking Tab

Option text String argument
Settings, Enable error checking Enable Error Checking
Settings, Error indicator color Error Checking Indicator Color
Form/Report Design Rules, Unassociated label and control Unassociated Label and Control Error Checking
Form/Report Design Rules, New unassociated labels New Unassociated Labels Error Checking
Form/Report Design Rules, Keyboard shortcut errors Keyboard Shortcut Errors Error Checking
Form/Report Design Rules, Invalid control properties Invalid Control Properties Error Checking
Form/Report Design Rules, Common report errors Common Report Errors Error Checking

Note  If you are developing a database application, add-in, library database, or referenced database, make sure that the Error Trapping option is set to 2 (Break On Unhandled Errors) when you have finished debugging your code.

The value that you pass to the SetOption method as the setting argument depends on which type of option you are setting. The following table establishes some guidelines for setting options.

If the option is Then the setting argument is
A text box A string
A check box A Boolean value — True (–1) or False (0)
An option button in an option group, or an option in a combo box or a list box An integer corresponding to the option's position in the option group or list (starting with zero [0])