Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SetLocalVar Macro Action

Last modified: June 29, 2011

Applies to: Access 2013 | Office 2013

The SetLocalVar action creates a temporary variable and set it to a specific value.

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.

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]
NoteNote

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]

Show:
© 2015 Microsoft