Application SetOption Method

The SetOption method of the Application object allows you to control all of the options in the Access Options dialog box which is available from the Office button. The following tables detail the string arguments for the options available on each group. For example, to control the visibility of the Status Bar within your Access application, you'd use the following code.

Application.SetOption "Show Status Bar", True

The arguments you need to manipulate the SetOption method are broken down by the tab of the Access Options dialog box on which they appear.

In previous versions of Access, certain settings were available in the Startup dialog box under the Tools menu. In Access 2007, these settings are included in the Access Options dialog box, but are not set using Application.SetOption. Instead, they can be set or retrieved using the Properties collection of the DAO.Database object for an ACCDB or MDB file. These properties are described in the following tables.

Popular Options

Section

Option Text

String Argument

Top options for working with Access Always use ClearType

None

ScreenTip style

None

Show shortcut keys in ScreenTips

None

Color scheme

None

Creating databases

Default file format

Default File Format

Directory

Default database folder

Default Database

New database sort order

New Database Sort Order

Current Database Options

Section

Option Text

String Argument

Application Options

Use as Form and Report icon

UseAppIconForFrmRpt (set using Properties collection)

Display Form

StartupForm (set using Properties collection)

Display Status Bar

Show Status Bar

Document Window Options

UseMDIMode (set to False to use Tabbed Documents)

Display Document Tabs

ShowDocumentTabs (set using Properties collection)

Compact on Close

Auto Compact

Remove personal information from file properties on save

Remove Personal Information

Use Windows-themed Controls on Forms

Themed Form Controls

Enable Layout View for this Database

None

Enable design changes for tables in Datasheet view (for this database)

AllowDatasheetSchema (set using Properties collection)

Check for truncated number fields

CheckTruncatedNumFields

Picture Property Storage Format

Picture Property Storage Format

Navigation

Display Navigation Pane

StartupShowDBWindow (set using Properties collection)

Current Database Options

Section

Option Text

String Argument

Ribbon and Toolbar Options

Ribbon Name

CustomRibbonID (set using Properties collection)

Menu Bar

StartupMenuBar (set using Properties collection)

Shortcut Menu Bar

StartupShortcutMenuBar (set using Properties collection)

Allow Full Menus

AllowFullMenus (set using Properties collection)

Allow Default Shortcut Menus

AllowShortcutMenus (set using Properties collection)

Allow Built-in Toolbars

AllowBuiltInToolbars (set using Properties collection)

Name AutoCorrect Options

Track name AutoCorrect info

Track Name AutoCorrect Info

Perform name AutoCorrect

Perform Name AutoCorrect

Log name AutoCorrect changes

Log Name AutoCorrect Changes

Filter lookup options for Database

Show list of values in Local indexed fields

Local Show Values in Indexed

Show list of values in Local non-indexed fields

Local 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 (ADP files only)

Show list of values in, Records at server

Show Values in Server (ADP files only)

Don't display lists where more of this number of records read

Show Values in Limit

Datasheet Options

Section

Option Text

String Argument

Default colors

Font color

Default Font Color

Background color

Default Background Color

Datasheet Options

Section

Option Text

String Argument

Alternate background color

None

Gridlines color

Default

Gridlines Color

Gridline and cell effects Default gridlines showing horizontal

Default

Gridlines Horizontal

Default gridlines showing vertical

Default

Gridlines Vertical

Default cell effect

Default

Cell Effect

Default column width

Default

Column Width

Default font

Font

Default

Font Name

Size

Default

Font Size

Weight

Default

Font Weight

Underline

Default

Font Underline

Italic

Default

Font Italic

Object Designers Options

Section

Option Text

String Argument

Table design

Default field type

Default

Field Type

Default text field size

Default

Text Field Size

Default number field size

Default

Number Field Size

AutoIndex on Import/Create

AutoIndex on Import/Create

Show Property Update Options button

Show Property Update Options buttons

Query design

Show table names

Show Table Names

Output all fields

Output All Fields

Enable AutoJoin

Enable AutoJoin

Query design font

Query Design Font Name

Query design font size

Query Design Font Size

Run Permissions

Run Permissions (MDB files only)

SQL Server Compatible Syntax (ANSI92) This database

ANSI Query Mode

SQL Server Compatible Syntax (ANSI92) Default for new databases

ANSI Query Mode Default

Object Designers Options

Section

Option Text

String Argument

Forms/Reports

Selection behavior

Selection Behavior

Form template

Form Template

Report template

Report Template

Always use event procedures

Always Use Event Procedures

Error checking

Enable error checking

Enable Error Checking

Check for unassociated label and control

Unassociated Label and Control Error Checking

Check for new unassociated labels

New Unassociated Label Error Checking

Check for keyboard shortcut errors

Keyboard Shortcut Errors Error Checking

Check for invalid control properties

Invalid Control Properties Error Checking

Check for common report errors

Common Report Errors Error Checking

Error indicator color

Error Checking Indicator Color

Proofing Options

Section

Option Text

String Argument

When correcting spelling in Office programs

Ignore words in UPPERCASE

Spelling ignore words in UPPERCASE

Ignore words that contain numbers

Spelling ignore words with number

Ignore Internet and file addresses

Spelling ignore Internet and file addresses

Flag repeated words

None

Enforce accented uppercase in French

None

Suggest from main dictionary only

Spelling suggest from main dictionary only

French modes

Section

Option Text

String Argument

Dictionary language

Spelling dictionary language

Hebrew modes (Hebrew language only)

Spelling Hebrew modes

Arabic modes (Arabic language only)

Spelling Arabic modes

Use post-reform rules (German language only)

Spelling use German postreform rules

Combine aux verb/adj (Korean language only)

Spelling combine aux verb/adj

Search misused word list (Korean language only)

Spelling use auto-change list

Process compound nouns (Korean language only) Spelling process compound nouns

Advanced Options

Section

Option Text

String Argument

Editing

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

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

Default direction

Default

direction

General alignment

General

alignment

Cursor movement

Cursor movement

Datasheet IME control

Datasheet Ime Control

Auto commit

IME Autocommit (East Asian locales only)

Use Hijri Calendar Use Hijri Calendar

Section

Option Text

String Argument

Display

Show this number of Recent Documents

Size of MRU File List

Status bar

Show Status Bar

Show animations

Show Animations

Show Smart Tags on Datasheets

Show SmartTags on Datasheets

Reports

Show Smart Tags on Forms and Reports

Show SmartTags on Forms and

Show Names column in Macro Design

Show Macro Names Column

Show Conditions column in Macro Design

Show Conditions Column

Printing

Left margin

Left Margin

Right margin

Right Margin

Top margin

Top Margin

Bottom margin

Bottom Margin

General

Show add-in user interface errors

None

Provide feedback with sound

Provide Feedback with Sound

Use four-digit year formatting - This database

Four-Digit Year Formatting

Databases

Use four-digit year formatting - AH databases

Four-Digit Year Formatting All

Advanced

Default Max Records (applies to ADP files only)

Row Limit

Open last used database when Access starts

Open Last Used Database When Access Starts

Default open mode

Default Open Mode for Databases

Default record locking

Default Record Locking

Open databases by using record-level locking

Use Row Level Locking

OLE/DDE Timeout (sec)

OLE/DDE Timeout (sec)

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)

Ignore DDE requests

Ignore DDE Requests

Enable DDE refresh

Enable DDE Refresh

Command-line arguments

Command-Line Arguments

Others not in the dialog box

Certain options that were available in Access 2003 have been moved to other locations or no longer apply to Access 2007 and do not appear in the Access Options dialog box. Specifically, options related to Data Access Pages are no longer supported.

Option Text

String Argument

Access 2007 Location

Show, Startup Task Pane

Show Startup Dialog Box

Not applicable in Access 2007

Show, New object shortcuts

Show New Object Shortcuts

Not applicable in Access 2007

Show, Hidden objects

Show Hidden Objects

Navigation Options dialog box

Show, System objects

Show System Objects

Navigation Options dialog box

Show, Windows in Taskbar

ShowWindowsInTaskbar

Not applicable in Access 2007

Click options in database window

Database Explorer Click Behavior

Not applicable in Access 2007

Recently used file list

Enable MRU File List

Not applicable in Access 2007

As mentioned in Chapter 13, an enum or enumeration is a group of related constant values. The Access object model contains many enums that you can use in your applications. There are so many in fact that there are too many to list here! For example, the AcCommand enum contains more than 600 values of its own! Obviously we can't list them all here, but the following table introduces you to some enums built in to Access that we think you'll run across quite frequently. Using enums and constants is a big step toward making code more readable, so it's recommended that you use them where possible.

Enum Members Usage

AcCloseSave acSaveNo DoCmd.Close acSavePrompt acSaveYes

AcCommand acCmdAddFromOutlook Application.RunCommand acCmdCloseAll DoCmd.RunCommand acCmdCompileAndSaveAllModules acCmdConnection acCmdCopy acCmdCreateShortcut acCmdCut acCmdDeleteRecord

Enum Members Usage acCmdDuplicate acCmdEncryptDecryptDatabase acCmdFind acCmdLinkedTableManager acCmdPaste acCmdPasteSpecial acCmdRunMacro acCmdSave acCmdSaveAsOutlookContact acCmdSavedImports acCmdSaveRecord acCmdSetDatabasePassword acCmdShowColumnHistory acCmdSpelling acCmdStartupProperties acCmdWorkgroupAdministrator

AcDataObjectType acActiveDataObject DoCmd.GoToRecord acDataForm acDataFunction acDataQuery acDataReport acDataServerView acDataStoredProcedure acDataTable

AcFileFormat acFileFormatAccess2 CurrentProject.FileFormat acFileFormatAccess2000

acFileFormatAccess2002

acFileFormatAccess2007

acFileFormatAccess95

acFileFormatAccess97

Enum

Members

Usage

AcFormOpenDataMode

acFormAdd

DoCmd.OpenForm

acFormEdit

acFormPropertySettings

acFormReadOnly

AcObjectType

acDefault

AccessObject.Type

acDiagram

Application.CurrentObjectType

acForm

Application.GetHiddenAttribute

acFunction

Application.SetHiddenAttribute

acMacro

DoCmd.Close

acModule

DoCmd.CopyObject

acQuery

DoCmd.DeleteObject

acReport

DoCmd.Rename

acServerView

DoCmd.RepaintObject

acStoredProcedure

DoCmd.SelectObject

acTable

DoCmd.TransferDatabase

AcOutputObjectType

acOutputForm

DoCmd.OutputTo

acOutputFunction

acOutputModule

acOutputQuery

acOutputReport

acOutputServerView

acOutputStoredProcedure

acOutputTable

AcProjectType

acADP

CurrentProject.ProjectType

acMDB

acNull

AcQuitOption

acQuitPrompt

Application.Quit

acQuitSaveAll

DoCmd.Quit

acQuitSaveNone

AcRecord

acFirst

DoCmd.GoToRecord

Enum Members Usage acGoTo acLast acNewRec acNext acPrevious

AcSendObjectType acSendForm DoCmd.SendObject acSendModule acSendNoObject acSendQuery acSendReport acSendTable

AcTextTransferType acExportDelim DoCmd.TransferText acExportFixed acExportHTML

acExportMerge aclmportDelim aclmportFixed aclmportHTML

acLinkDelim acLinkFixed acLinkHTML

AcWindowMode acDialog DoCmd.OpenForm acHidden DoCmd.OpenReport acIcon acWindowNormal

+1 0

Post a comment