Set Options from Visual Basic

Set Options from Visual Basic

See Also

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). The exceptions are noted with a (MDB only) or (ADP only) notation.

View Tab

Option text String argument
Show  
Status bar Show Status Bar
Startup dialog box Show Startup Dialog Box
New object shortcuts Show New Object Shortcuts
Hidden objects Show Hidden Objects
System objects Show System Objects
Use taskbar for each document Use Taskbar For Each Document
Show in macro design  
Names column Show Macro Names Column
Conditions column Show Conditions Column
Click options in database window Database Explorer Click Behavior
Use substitute font Enable Font Switching
Substitute font name Substitute Font Name

General Tab

Option text String argument
Print margins  
Left Margin Left Margin
Right Margin Right Margin
Top Margin Top Margin
Bottom Margin Bottom Margin
Default database folder Default Database Directory
Provide feedback with sound Provide Feedback With Sound
Recently used file list Enable MRU File List
# of recently used file list Size of MRU File List
New database sort order (MDB only) New Database Sort Order
Compact current database Auto Compact
Compact when database will shrink by this percentage or more Auto Compact Percentage
Name AutoCorrect (MDB only)  
Track name AutoCorrect info Track Name AutoCorrect Info
Perform name AutoCorrect Perform Name AutoCorrect
Log name AutoCorrect changes Log Name AutoCorrect Changes

WebOptions Button (General tab)

Options listed in italic are listed for backward compatibility. With the exception of the Show Hyperlink Addresses In Status Bar option, all other options are hidden but can be set with the SetOption method. For more information about Web options, see DefaultWebOptions.

Option text String argument
Hyperlink color Hyperlink Color
Followed Hyperlink color Followed Hyperlink color
Underline hyperlinks Underline Hyperlinks
Show Hyperlink Addresses In Status Bar Note   Not valid for Microsoft Access 2000. Address shown in tooltips.
HTML Template HTML Template
Data Source Name Data Source Name
User Name User Name
Password Password
Server URL Active Server Pages URL
Session Timeout Active Server Pages Session Timeout

Edit/Find Tab

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

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

Datasheet Tab

Option text String argument
Default Colors  
Font Default Font Color
Background Default Background Color
Gridlines Default Gridlines Color
Default gridlines showing  
Horizontal Default Gridlines Horizontal
Vertical Default Gridlines Vertical
Default column width Default Column Width
Default Font  
Font Default Font Name
Weight Default Font Weight
Size Default Font Size
Italic Default Font Italic
Underline Default Font Underline
Default cell effect Default Cell Effect
Show animations Show Animations

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

Advanced Tab (MDB Only)

Option text String argument
Ignore DDE Requests Ignore DDE Requests
Enable DDE Refresh Enable DDE Refresh
Default Open Mode Default Open Mode for Databases
Command-Line Arguments Command-Line Arguments
OLE/DDE Timeout (Sec) OLE/DDE Timeout (Sec)
Number Of Update Retries Number of Update Retries
ODBC Refresh Interval (Sec) ODBC Refresh Interval (Sec)
Refresh Interval (Sec) Refresh Interval (Sec)
Update Retry Interval (Msec) Update Retry Interval (Msec)
Default Record Locking Default Record Locking
Use Record Level Locking Use Record Level Locking

Advanced Tab (ADP Only)

Option text String argument
Ignore DDE Requests Ignore DDE Requests
Enable DDE Refresh Enable DDE Refresh
Default Max Records Row Limit
Save login and password Save Login And Password
Command-Line Arguments Command-Line Arguments
OLE/DDE Timeout (Sec) OLE/DDE Timeout (Sec)

Tables/Queries Tab (MDB Only)

Option text String argument
Default field sizes  
Text Default Text Field Size
Number Default Number Field Size
Default Field Type Default Field Type
AutoIndex On Import/Create AutoIndex On Import/Create
Show table names Show Table Names
Output all fields Output All Fields
Enable AutoJoin Enable AutoJoin
Run Permissions Run Permissions

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])