Set Options from Visual Basic

Microsoft Access Visual Basic

Show All

Set Options from Visual Basic

   

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 barShow Status Bar
Show, Startup Task PaneShow Startup Dialog Box
Show, New object shortcutsShow New Object Shortcuts
Show, Hidden objectsShow Hidden Objects
Show, System objectsShow System Objects
Show, Windows in TaskbarShowWindowsInTaskbar
Show in Macro Design, Names columnShow Macro Names Column
Show in Macro Design, Conditions columnShow Conditions Column
Click options in database windowDatabase Explorer Click Behavior

General Tab

Option text String argument
Print margins, Left marginLeft Margin
Print margins, Right marginRight Margin
Print margins, Top marginTop Margin
Print margins, Bottom marginBottom Margin
Use four-year digit year formatting, This databaseFour-Digit Year Formatting
Use four-year digit year formatting, All databasesFour-Digit Year Formatting All Databases
Name AutoCorrect, Track name AutoCorrect infoTrack Name AutoCorrect Info
Name AutoCorrect, Perform name AutoCorrectPerform Name AutoCorrect
Name AutoCorrect, Log name AutoCorrect changesLog Name AutoCorrect Changes
Recently used file listEnable MRU File List
Recently used file list, (number of files)Size of MRU File List
Provide feedback with soundProvide Feedback with Sound
Compact on CloseAuto Compact
New database sort orderNew Database Sort Order
Remove personal information from this fileRemove Personal Information
Default database folderDefault Database Directory

Edit/Find Tab

Option text String argument
Default find/replace behaviorDefault Find/Replace Behavior
Confirm, Record changesConfirm Record Changes
Confirm, Document deletionsConfirm Document Deletions
Confirm, Action queriesConfirm Action Queries
Show list of values in, Local indexed fieldsShow Values in Indexed
Show list of values in, Local nonindexed fieldsShow Values in Non-Indexed
Show list of values in, ODBC fieldsShow Values in Remote
Show list of values in, Records in local snapshotShow Values in Snapshot
Show list of values in, Records at serverShow Values in Server
Don't display lists where more than this number of records readShow Values Limit

Datasheet Tab

Option text String argument
Default colors, FontDefault Font Color
Default colors, BackgroundDefault Background Color
Default colors, GridlinesDefault Gridlines Color
Default gridlines showing, HorizontalDefault Gridlines Horizontal
Default gridlines showing, VerticalDefault Gridlines Vertical
Default column widthDefault Column Width
Default font, FontDefault Font Name
Default font, WeightDefault Font Weight
Default font, SizeDefault Font Size
Default font, UnderlineDefault Font Underline
Default font, ItalicDefault Font Italic
Default cell effectDefault Cell Effect
Show animationsShow Animations

Keyboard Tab

Option text String argument
Move after enterMove After Enter
Behavior entering fieldBehavior Entering Field
Arrow key behaviorArrow Key Behavior
Cursor stops at first/last fieldCursor Stops at First/Last Field
Auto commitIme Autocommit
Datasheet IME controlDatasheet Ime Control

Tables/Queries Tab

Option text String argument
Table design, Default field sizes - TextDefault Text Field Size
Table design, Default field sizes - NumberDefault Number Field Size
Table design, Default field typeDefault Field Type
Table design, AutoIndex on Import/CreateAutoIndex on Import/Create
Query design, Show table namesShow Table Names
Query design, Output all fieldsOutput All Fields
Query design, Enable AutoJoinEnable AutoJoin
Query design, Run permissionsRun Permissions
Query design, SQL Server Compatible Syntax (ANSI 92) - This databaseANSI Query Mode
Query design, SQL Server Compatible Syntax (ANSI 92) - Default for new databasesANSI Query Mode Default

Forms/Reports Tab

Option text String argument
Selection behaviorSelection Behavior
Form templateForm Template
Report templateReport Template
Always use event proceduresAlways Use Event Procedures

Advanced Tab

Option text String argument
DDE operations, Ignore DDE requestsIgnore DDE Requests
DDE operations, Enable DDE refreshEnable DDE Refresh
Default File FormatDefault File Format
Client-server settings, Default max recordsRow Limit
Default open modeDefault Open Mode for Databases
Command-line argumentsCommand-Line Arguments
OLE/DDE timeoutOLE/DDE Timeout (sec)
Default record lockingDefault Record Locking
Refresh intervalRefresh Interval (sec)
Number of update retriesNumber of Update Retries
ODBC fresh intervalODBC Refresh Interval (sec)
Update retry intervalUpdate Retry Interval (msec)
Open databases using record-level lockingUse Row Level Locking
Save login and passwordSave Login and Password

Pages Tab

Option text String argument
Default Designer Properties, Section IndentSection Indent
Default Designer Properties, Alternative Row ColorAlternate Row Color
Default Designer Properties, Caption Section StyleCaption Section Style
Default Designer Properties, Footer Section StyleFooter Section Style
Default Database/Project Properties, Use Default Page FolderUse Default Page Folder
Default Database/Project Properties, Default Page FolderDefault Page Folder
Default Database/Project Properties, Use Default Connection FileUse Default Connection File
Default Database/Project Properties, Default Connection FileDefault Connection File

Spelling Tab

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

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