SetLocalVar Macro Action
The SetLocalVar action creates a temporary variable and set it to a specific value.
Setting
The SetLocalVar action has the following arguments.
Argument |
Required |
Description |
---|---|---|
Name |
Yes |
A string that specifies the name of the variable. |
Expression |
Yes |
An expression that will be used to set the value for this temporary variable. Do not precede the expression with the equal sign (=). You can click the Build button to use the Expression Builder to set this argument. |
Remarks
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.
Once a temporary variable has been created, you can refer to it in an expression. For example, if you created a temporary variable named TotalAmount, you could use the variable as the control source for a text box by using the following syntax.
=[LocalVars]![TotalAmount]
Note
In a Data Macro, you do not have to use the LocalVars collection to refer to a variable. For example, if you created a temporary variable in a Data Macro named TotalAmount, you could use the variable as the control source for a text box by using the following syntax
=[TotalAmount]