Changing Options


You can set the configuration options that are available in the Options dialog box, shown in Figure 15-3. (To see the Options dialog box, select Tools | Options.)

click to expand
Figure 15-3: Options dialog box

Let’s say we want to shut off the Status Bar and the Startup Task Pane programmatically. To do this, we can call the Application object’s SetOption method and pass it two arguments: a predefined string indicating the option that we want to modify, and the new value of the option. The following code can accomplish that task:

Public Sub setOptions()   With Application   .SetOption "show status bar", False   .SetOption "show startup dialog box", False   End With End Sub

Again, as with the Startup dialog box, you can look at the Options dialog box and see the corresponding options shut off.

The following sections give you the strings corresponding to the settings in each tab of the Options dialog box. Note that all of the options are found in Access 2003, although they are not all found in earlier versions.

Unfortunately, there is no Delete method to reset the defaults, as there is for the Properties collection that controls the startup procedures. Instead, you should save the original values to variables and then call on those variables to reset the property. You can find the original value of the property by calling the GetOption method before you call the SetOption method to change that option’s value. It takes as its single argument the string shown in the String Argument column in the tables presented in the following sections.

To set the value of an option, you have to provide the SetOption method with not only the name of the option, but also with the value you’d like it to have. The rules for doing this are:

  • If the option is represented by a checkbox in the interface, you can assign an Integer value of –1 or a Boolean value of True for On, and an Integer value of 0 or a Boolean value of False for Off.

  • If the option is represented by a set of option buttons in the interface, you can assign a value of 0 if you’d like to programmatically select the first button, 1 if you’d like to programmatically select the second button, etc.

  • If the item is represented by a list box or a drop-down list box in the interface, a value of 0 represents the first item, 1 represents the second, and so on.

  • If the option is represented by a text box, it can be either a String, an Integer, or a Long (a long integer). As long as the string is in the appropriate format or numeric range, Access will automatically handle the conversion from a string to a nonstring data type, if necessary. To get some sense of the range and format of valid values, check the documentation and use the GetOption method to retrieve the existing setting.

View Tab

The options on the View tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Show, Status bar

Show Status Bar

Integer or Boolean

Show, Startup Task Pane

Show Startup Dialog Box

Integer or Boolean

Show, New object shortcuts

Show New Object Shortcuts

Integer or Boolean

Show, Hidden objects

Show Hidden Objects

Integer or Boolean

Show, System objects

Show System Objects

Integer or Boolean

Show, Windows in Taskbar

ShowWindowsInTaskbar

Integer or Boolean

Show in Macro Design, Names column

Show Macro Names Column

Integer or Boolean

Show in Macro Design, Conditions column

Show Conditions Column

Integer or Boolean

Click options in database window

Database Explorer Click Behavior

Integer

General Tab

The options on the General tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Print margins, Left margin

Left Margin

String

Print margins, Right margin

Right Margin

String

Print margins, Top margin

Top Margin

String

Print margins, Bottom margin

Bottom Margin

String

Use four-year digit year formatting, This database

Four-Digit Year Formatting

Integer/Boolean

Use four-year digit year formatting, All databases

Four-Digit Year Formatting All Databases

Integer/Boolean

Name AutoCorrect, Track name AutoCorrect info

Track Name AutoCorrect Info

Integer/Boolean

Name AutoCorrect, Perform name AutoCorrect

Perform Name AutoCorrect

Integer/Boolean

Name AutoCorrect, Log name AutoCorrect changes

Log Name AutoCorrect Changes

Integer/Boolean

Recently used file list

Enable MRU File List

Integer/Boolean

Recently used file list, (number of files)

Size of MRU File List

Integer

Provide feedback with sound

Provide Feedback with Sound

Integer/Boolean

Compact on Close

Auto Compact

Integer/Boolean

New database sort order

New Database Sort Order

Long

Remove personal information from file properties on save

Remove Personal Information

Integer/Boolean

Default database folder

Default Database Directory

String

Edit/Find Tab

The options on the Edit/Find tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Default find/replace behavior

Default Find/Replace Behavior

Integer

Confirm, Record changes

Confirm Record Changes

Integer/Boolean

Confirm, Document deletions

Confirm Document Deletions

Integer/Boolean

Confirm, Action queries

Confirm Action Queries

Integer/Boolean

Show list of values in, Local indexed fields

Show Values in Indexed

Integer/Boolean

Show list of values in, Local nonindexed fields

Show Values in Non-Indexed

Integer/Boolean

Show list of values in, ODBC fields

Show Values in Remote

Integer/Boolean

Show list of values in, Records in local snapshot

Show Values in Snapshot

Integer/Boolean

Show list of values in, Records at server

Show Values in Server

Integer/Boolean

Don’t display lists where more than this number of records read

Show Values Limit

Integer

Keyboard Tab

The options on the Keyboard tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Move after enter

Move After Enter

Integer

Behavior entering field

Behavior Entering Field

Integer

Arrow key behavior

Arrow Key Behavior

Integer

Cursor stops at first/last field

Cursor Stops at First/Last Field

Integer/Boolean

Auto commit

Ime Autocommit

Integer/Boolean

Datasheet IME control

Datasheet Ime Control

Integer/Boolean

Datasheet Tab

The options on the Datasheet tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Default colors, Font

Default Font Color

Integer

Default colors, Background

Default Background Color

Integer

Default colors, Gridlines

Default Gridlines Color

Integer

Default gridlines showing, Horizontal

Default Gridlines Horizontal

Integer/Boolean

Default gridlines showing, Vertical

Default Gridlines Vertical

Integer/Boolean

Default column width

Default Column Width

String

Default font, Font

Default Font Name

String

Default font, Weight

Default Font Weight

Integer

Default font, Size

Default Font Size

Long

Default font, Underline

Default Font Underline

Integer/Boolean

Default font, Italic

Default Font Italic

Integer/Boolean

Default cell effect

Default Cell Effect

Integer

Show animations

Show Animations

Integer/Boolean

Show Smart Tags on Datasheets

Show Smart Tags on Datasheets

Integer/Boolean

Forms/Reports Tab

The options on the Forms/Reports tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Selection behavior

Selection Behavior

Integer

Form template

Form Template

String

Report template

Report Template

String

Always use event procedures

Always Use Event Procedures

Integer/Boolean

Show Smart Tags on Forms

Show Smart Tags on Forms

Integer/Boolean

Show Windows Themed Controls on Forms

Themed Form Controls

Integer/Boolean

Pages Tab

The options on the Pages tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Default Designer Properties, Section Indent

Section Indent

String

Default Designer Properties, Alternate Row Color

Alternate Row Color

String

Default Designer Properties, Caption Section Style

Caption Section Style

String

Default Designer Properties, Footer Section Style

Footer Section Style

String

Default Database/Project Properties, Use Default Page Folder

Use Default Page Folder

Integer/Boolean

Default Database/Project Properties, Default Page Folder

Default Page Folder

String

Default Database/Project Properties, Use Default Connection File

Use Default Connection File

Integer/Boolean

Default Database/Project Properties, Default Connection File

Default Connection File

String

Advanced Tab

The options on the Advanced tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

DDE operations, Ignore DDE requests

Ignore DDE Requests

Integer/Boolean

DDE operations, Enable DDE refresh

Enable DDE Refresh

Integer/Boolean

Default File Format

Default File Format

Integer

Default open mode

Default Open Mode for Databases

Integer

Command-line arguments

Command-Line Arguments

String

OLE/DDE timeout (sec)

OLE/DDE Timeout (sec)

Integer

Default record locking

Default Record Locking

Integer

Refresh interval (sec)

Refresh Interval (sec)

Integer

Number of update retries

Number of Update Retries

Integer

ODBC refresh interval (sec)

ODBC Refresh Interval (sec)

Integer

Update retry interval (msec)

Update Retry Interval (msec)

Integer

Open databases using record-level locking

Use Row Level Locking

Integer/Boolean

International Tab

The options on the International tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Right-to-Left, Default direction

Default direction

Integer

Right-to-Left, General alignment

General alignment

Integer

Right-to-Left, Cursor movement

Cursor movement

Integer

Use Hijri Calendar

Use Hijri Calendar

Integer/Boolean

Error Checking Tab

The options on the Error Checking tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Settings, Enable error checking

Enable Error Checking

Integer/Boolean

Settings, Error indicator color

Error Checking Indicator Color

Integer

Form/Report Design Rules, Unassociated label and control

Unassociated Label and Control Error Checking

Integer/Boolean

Form/Report Design Rules, New unassociated labels

New Unassociated Labels Error Checking

Integer/Boolean

Form/Report Design Rules, Keyboard shortcut errors

Keyboard Shortcut Errors Error Checking

Integer/Boolean

Form/Report Design Rules, Invalid control properties

Invalid Control Properties Error Checking

Integer/Boolean

Form/Report Design Rules, Common report errors

Common Report Errors Error Checking

Integer/Boolean

Spelling Tab

The options on the Spelling tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Dictionary Language

Spelling dictionary language

Long

Add words to

Spelling add words to

String

Suggest from main dictionary only

Spelling suggest from main dictionary only

Integer/Boolean

Ignore words in UPPERCASE

Spelling ignore words in UPPERCASE

Integer/Boolean

Ignore words with numbers

Spelling ignore words with number

Integer/Boolean

Ignore Internet and file addresses

Spelling ignore Internet and file addresses

Integer/Boolean

Language-specific, German: Use post-reform rules

Spelling use German post-reform rules

Integer/Boolean

Language-specific, Korean: Combine aux verb/adj.

Spelling combine aux verb/adj

Integer/Boolean

Language-specific, Korean: Search misused word list

Spelling use auto-change list

Integer/Boolean

Language-specific, Korean: Process compound nouns

Spelling process compound nouns

Integer/Boolean

Language-specific, Hebrew modes

Spelling Hebrew modes

Integer

Language-specific, Arabic modes

Spelling Arabic modes

Integer

Tables/Queries Tab

The options on the Tables/Queries tab and their string equivalents are as follows:

Option Text

String Argument

Data Type

Table design, Default field sizes - Text

Default Text Field Size

Integer

Table design, Default field sizes - Number

Default Number Field Size

Integer

Table design, Default field type

Default Field Type

Integer

Table design, AutoIndex on Import/Create

AutoIndex on Import/Create

String

Query design, Show table names

Show Table Names

Integer/Boolean

Query design, Output all fields

Output All Fields

Query design, Enable AutoJoin

Enable AutoJoin

Integer/Boolean

Query design, Run permissions

Run Permissions

Integer

Query design, SQL Server Compatible Syntax (ANSI 92) - This database

ANSI Query Mode

Integer/Boolean

Query design, SQL Server Compatible Syntax (ANSI 92) – Default for new databases

ANSI Query Mode Default

Integer/Boolean

Query design, Query design font, Font

Query Design Font Name

String

Query design, Query design font, Size

Query Design Font Size

Long

Show Property Update Options buttons

Show Property Update Options buttons

Integer/Boolean




Access VBA Programming
Microsoft Access VBA Programming for the Absolute Beginner
ISBN: 1598633937
EAN: 2147483647
Year: 2006
Pages: 214
Authors: Michael Vine

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net