Visual Basic を使用してオプションを設定する

SetOption メソッドと GetOption メソッドを使用して、コードから [アクセス オプション] ダイアログ ボックスでオプション値を設定および返します。 [ Access のオプション] ダイアログ ボックスを表示するには、[Microsoft Office] ボタンをクリックし、[ Access のオプション] をクリックします。

SetOption メソッドの引数 setting に指定する値は、設定するオプションの種類によって異なります。 次の表に、代表的なオプションで設定できる値を示します。

指定するオプション 引数 setting の値
テキスト ボックス 文字列
チェック ボックス ブール値 — True (-1) または False (0)
オプション グループの中のオプション ボタン、あるいは、コンボ ボックスまたはリスト ボックスの中のオプション オプション グループまたは一覧の中のオプションの位置に対応する [0] から始まる整数

以下の表は、コードから設定または取得できるすべてのオプションの名前と、それに対応する SetOption メソッドおよび GetOption メソッドの文字列引数を、[Access のオプション] ダイアログ ボックスのタブごとに示したものです。

[データベースの作成] セクション

オプション テキスト String 引数
新規データベースの並び順序 New Database Sort Order
既定のデータベース フォルダー Default Database Directory
既定のファイル形式 Default File Format

[現在のデータベース] タブ

[アプリケーション オプション] セクション

オプション テキスト String 引数
閉じる時に最適化する Auto Compact
ファイルを保存するときにファイルのプロパティから個人情報を削除する Remove Personal Information
フォーム上のコントロールに Windows のテーマを使用する Themed Form Controls
このデータベースのレイアウト ビューを有効にする DesignWithData
数値フィールドの文字切れをチェックする CheckTruncatedNumFields
Picture プロパティの保存形式 Picture Property Storage Format

autoCorrect オプションに名前を付けますセクション

オプション テキスト String 引数
名前の自動修正情報をトラックする Track Name AutoCorrect Info
名前の自動修正を行う Perform Name AutoCorrect
名前の自動修正の変更を記録する Log Name AutoCorrect Changes

[データベース] セクションの検索オプションを <Database Name> フィルター処理する

オプション テキスト String 引数
Show list of values in, Local indexed fields Show Values in Indexed
Show list of values in, Local nonindexed fields 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
Show list of values in, Records at server Show Values in Server
レコード数が次の値を超えるときは、リストを表示しない Show Values Limit

[データシート] タブ

[既定の色] セクション

オプション テキスト String 引数
フォントの色 Default Font Color
背景色 Default Background Color
代替の背景色 _64
枠線の色 Default Gridlines Color

[枠線とセルの表示] セクション

オプション テキスト String 引数
Default gridlines showing, Horizontal Default Gridlines Horizontal
Default gridlines showing, Vertical Default Gridlines Vertical
セルの立体表示 Default Cell Effect
既定の列幅 Default Column Width

[既定のフォント] セクション

オプション テキスト String 引数
Font Default Font Name
Size Default Font Size
太さ Default Font Weight
下線 Default Font Underline
斜体 Default Font Italic

[オブジェクト デザイナー] タブ

[テーブル デザイン] セクション

オプション テキスト String 引数
テキスト型のフィールド サイズ Default Text Field Size
数値型のフィールド サイズ Default Number Field Size
既定のデータ型 Default Field Type
インデックスを自動作成するフィールド AutoIndex on Import/Create
[プロパティの更新オプション] ボタンを表示する Show Property Update Options Buttons

[クエリ デザイン] セクション

オプション テキスト String 引数
テーブル名を表示する Show Table Names
すべてのフィールドを表示する Output All Fields
フィールドの自動結合 Enable AutoJoin
SQL Server Compatible Syntax (ANSI 92), This database ANSI Query Mode
SQL Server Compatible Syntax (ANSI 92), Default for new databases ANSI Query Mode Default
Query design font, Font Query Design Font Name
Query design font, Size Query Design Font Size

[フォーム/レポート] セクション

オプション テキスト String 引数
ドラッグによるコントロールの選択 Selection Behavior
フォーム テンプレート Form Template
レポート テンプレート Report Template
常にイベント プロシージャを使用する Always Use Event Procedures

[エラー チェック] セクション

オプション テキスト String 引数
エラー チェックを行う Enable Error Checking
エラー インジケーターの表示色 Error Checking Indicator Color
関連付けられていないラベルとコントロールをチェックする Unassociated Label and Control Error Checking
関連付けられていない新しいラベルをチェックする New Unassociated Labels Error Checking
ショートカット キーのエラーをチェックする Keyboard Shortcut Errors Error Checking
無効なコントロール プロパティをチェックする Invalid Control Properties Error Checking
一般的なレポートのエラーをチェックする Common Report Errors Error Checking

[校正] タブ

[Microsoft Office プログラムのスペル チェック] セクション

オプション テキスト String 引数
すべて大文字の単語は無視する Spelling ignore words in UPPERCASE
数字を含む単語は無視する Spelling ignore words with number
インターネット アドレスとファイル パスは無視する Spelling ignore Internet and file addresses
メイン辞書のみ使用する Spelling suggest from main dictionary only
辞書の言語 Spelling dictionary language

[詳細設定] タブ

[編集] セクション

オプション テキスト String 引数
Enter キー入力後の動作 Move After Enter
フィールド移動時の動作 Behavior Entering Field
方向キーの動作 Arrow Key Behavior
先頭/最後のフィールドでカーソルを止める Cursor Stops at First/Last Field
既定の検索/置換 Default Find/Replace Behavior
Confirm, Record changes Confirm Record Changes
Confirm, Document deletions Confirm Document Deletions
Confirm, Action queries Confirm Action Queries
既定の方向 Default Direction
通常の並び順 General Alignment
カーソル移動 Cursor Movement
データシート上で IME を制御する Datasheet Ime Control
イスラム暦を使用する Use Hijri Calendar

表示セクション

オプション テキスト String 引数
最近使用したドキュメントの一覧に表示するドキュメントの数 Size of MRU File List
ステータス バー Show Status Bar
行や列をスライド表示する Show Animations
スマート タグをデータシートに表示する Show Smart Tags on Datasheets
スマート タグをフォームとレポートに表示する Show Smart Tags on Forms and Reports
Show in Macro Design, Names column Show Macro Names Column
Show in Macro Design, Conditions column Show Conditions Column

[印刷] セクション

オプション テキスト String 引数
左余白 Left Margin
右余白 Right Margin
上余白 Top Margin
下余白 Bottom Margin

General セクション

オプション テキスト String 引数
操作の結果を音で知らせる Provide Feedback with Sound
Use four-year digit year formatting, This database Four-Digit Year Formatting
Use four-year digit year formatting, All databases Four-Digit Year Formatting All Databases

[詳細] セクション

オプション テキスト String 引数
Access の起動時に、前回使用したデータベースを開く Open Last Used Database When Access Starts
既定の開くモード Default Open Mode for Databases
既定のレコード ロック Default Record Locking
レコード レベルでロックして開く Use Row Level Locking
OLE/DDE タイムアウト (秒) OLE/DDE Timeout (sec)
再表示の間隔 (秒) Refresh Interval (sec)
更新の回数 Number of Update Retries
ODBC の再表示の間隔 (秒) ODBC Refresh Interval (sec)
更新の間隔 (ミリ秒) Update Retry Interval (msec)
DDE operations, Ignore DDE requests Ignore DDE Requests
DDE operations, Enable DDE refresh Enable DDE Refresh
コマンド ライン引数 Command-Line Arguments

注:

  • データベースを作成した言語以外のバージョンの Access で、データベースを実行する場合は、GetOption および SetOption メソッドの引数は英語で指定する必要があります。
  • 一部のオプションは、Access データベースまたは Access プロジェクト (.adp) 内でのみ使用できます。
  • データベース アプリケーション、アドイン、ライブラリ データベース、または 参照先データベースを開発する場合は、コードのデバッグが終了したときに [エラー トラッピング] オプションの設定値が 2 (エラー処理対象外のエラーで中断) であることを確認してください。

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。