次の方法で共有


SetLocalVar マクロ アクション

適用先: Access 2013、Office 2013

"SetLocalVar/ローカル変数の設定" アクションは、一時変数を作成し、それを特定の値に設定します。

設定

"SetLocalVar/ローカル変数の設定" アクションの引数は次のとおりです。

引数

必須

説明

名前

はい

変数の名前を指定する文字列。

Expression

はい

An expression that will be used to set the value for this temporary variable. Do not precede the expression with the equal sign (=). [ビルド] ボタンをクリックすると、この引数を [式ビルダー] で設定できます。

注釈

Variables created by the SetLocalVar action can be used only in the macro in which they are defined. Use the SetTempVar action to define a variable that can be used in another macro, in an event procedure, or on a form or report.

一時変数を作成すると、それを式で参照できます。 たとえば、TotalAmount という一時変数を作成した場合、次の構文でこの変数をテキスト ボックスのコントロール ソースとして使用できます。

=[LocalVars]![TotalAmount]

注:

データ マクロでは、変数を参照するために LocalVars コレクションを使用する必要はありません。 たとえば、データ マクロで TotalAmount という一時変数を作成した場合、次の構文でこの変数をテキスト ボックスのコントロール ソースとして使用できます: =[TotalAmount]