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

Set Options from Visual Basic

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

You can use the SetOption and GetOption methods to set and return option values in the Access Options dialog box from code. To view the Access Options dialog box, click the Microsoft Office Button and then click Access Options.

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 isThen the setting argument is
A text boxA string
A check boxA Boolean value — True (-1) or False (0)
An option button in an option group, or an option in a combo box or a list boxAn integer corresponding to the option's position in the option group or list (starting with zero [0])

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 Access Options dialog box, followed by the corresponding string argument that you must pass to the SetOption or GetOption method.

Creating Databases Section

Option TextString Argument
New database sort orderNew Database Sort Order
Default database folderDefault Database Directory
Default file formatDefault File Format

Current Database Tab

Application Options section

Option TextString Argument
Compact on CloseAuto Compact
Remove personal information from file properties on saveRemove Personal Information
Use Windows-themed Controls on FormsThemed Form Controls
Enable Layout View for this databaseDesignWithData
Check for truncated number fieldsCheckTruncatedNumFields
Picture Property Storage FormatPicture Property Storage Format

Name AutoCorrect Options section

Option TextString Argument
Track name AutoCorrect infoTrack Name AutoCorrect Info
Perform name AutoCorrectPerform Name AutoCorrect
Log name AutoCorrect changesLog Name AutoCorrect Changes

Filter Lookup options for Database section

Option TextString Argument
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

Default colors section

Option TextString Argument
Font colorDefault Font Color
Background colorDefault Background Color
Alternate background color_64
Gridlines colorDefault Gridlines Color

Gridlines and cell effects section

Option TextString Argument
Default gridlines showing, HorizontalDefault Gridlines Horizontal
Default gridlines showing, VerticalDefault Gridlines Vertical
Default cell effectDefault Cell Effect
Default column widthDefault Column Width

Default font section

Option TextString Argument
FontDefault Font Name
SizeDefault Font Size
WeightDefault Font Weight
UnderlineDefault Font Underline
ItalicDefault Font Italic

Object Designers Tab

Table design section

Option TextString Argument
Default text field sizeDefault Text Field Size
Default number field sizeDefault Number Field Size
Default field typeDefault Field Type
AutoIndex on Import/CreateAutoIndex on Import/Create
Show Property Update Option ButtonsShow Property Update Options Buttons

Query design section

Option TextString Argument
Show table namesShow Table Names
Output all fieldsOutput All Fields
Enable AutoJoinEnable AutoJoin
SQL Server Compatible Syntax (ANSI 92), This databaseANSI Query Mode
SQL Server Compatible Syntax (ANSI 92), Default for new databasesANSI Query Mode Default
Query design font, FontQuery Design Font Name
Query design font, SizeQuery Design Font Size

Forms/Reports section

Option TextString Argument
Selection behaviorSelection Behavior
Form templateForm Template
Report templateReport Template
Always use event proceduresAlways Use Event Procedures

Error checking section

Option TextString Argument
Enable error checkingEnable Error Checking
Error indicator colorError Checking Indicator Color
Check for unassociated label and controlUnassociated Label and Control Error Checking
Check for new unassociated labelsNew Unassociated Labels Error Checking
Check for keyboard shortcut errorsKeyboard Shortcut Errors Error Checking
Check for invalid control propertiesInvalid Control Properties Error Checking
Check for common report errorsCommon Report Errors Error Checking

Proofing Tab

When correcting spelling in Microsoft Office programs section

Option TextString Argument
Ignore words in UPPERCASESpelling ignore words in UPPERCASE
Ignore words that contain numbersSpelling ignore words with number
Ignore Internet and file addressesSpelling ignore Internet and file addresses
Suggest from main dictionary onlySpelling suggest from main dictionary only
Dictionary LanguageSpelling dictionary language

Advanced Tab

Editing section

Option TextString 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
Default find/replace behaviorDefault Find/Replace Behavior
Confirm, Record changesConfirm Record Changes
Confirm, Document deletionsConfirm Document Deletions
Confirm, Action queriesConfirm Action Queries
Default directionDefault Direction
General alignmentGeneral Alignment
Cursor movementCursor Movement
Datasheet IME controlDatasheet Ime Control
Use Hijri CalendarUse Hijri Calendar

Display section

Option TextString Argument
Show this number of Recent DocumentsSize of MRU File List
Status barShow Status Bar
Show animationsShow Animations
Show Smart Tags on DatasheetsShow Smart Tags on Datasheets
Show Smart Tags on Forms and ReportsShow Smart Tags on Forms and Reports
Show in Macro Design, Names columnShow Macro Names Column
Show in Macro Design, Conditions columnShow Conditions Column

Printing section

Option TextString Argument
Left marginLeft Margin
Right marginRight Margin
Top marginTop Margin
Bottom marginBottom Margin

General section

Option TextString Argument
Provide feedback with soundProvide Feedback with Sound
Use four-year digit year formatting, This databaseFour-Digit Year Formatting
Use four-year digit year formatting, All databasesFour-Digit Year Formatting All Databases

Advanced Section

Option TextString Argument
Open last used database when Access startsOpen Last Used Database When Access Starts
Default open modeDefault Open Mode for Databases
Default record lockingDefault Record Locking
Open databases by using record-level lockingUse Row Level Locking
OLE/DDE timeout (sec)OLE/DDE Timeout (sec)
Refresh interval (sec)Refresh Interval (sec)
Number of update retriesNumber of Update Retries
ODBC refresh interval (sec)ODBC Refresh Interval (sec)
Update retry interval (msec)Update Retry Interval (msec)
DDE operations, Ignore DDE requestsIgnore DDE Requests
DDE operations, Enable DDE refreshEnable DDE Refresh
Command-line argumentsCommand-Line Arguments
  • If your database may run on a version of 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 an Access database or Access project (.adp).
  • 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.
© 2018 Microsoft