Share via


RemoveAllTempVars Macro Action

You can use the RemoveAllTempVars action to remove any temporary variables that you created by using the SetTempVar action.

Setting

The RemoveAllTempVars action does not have any arguments.

Remarks

  • You can have up to 255 temporary variables defined at one time. If you do not remove a temporary variable, it will remain in memory until you close the database or project. It is a good practice to remove temporary variables when you are finished using them.

  • Access automatically removes all temporary variables when you close the database or project.

  • To remove a single temporary variable, use the RemoveTempVar action and set its argument to the name of the temporary variable you want to remove.

  • To run the RemoveAllTempVars action in a VBA module, use the RemoveAll method of the TempVars object.

Example

The following macro demonstrates how to create a temporary variable, use it in a condition and a message box, and then remove the temporary variable by using the RemoveAllTempVars action.

Condition

Action

Arguments

SetTempVar

Name: MyVarExpression: InputBox("Enter a non-zero number.")

[TempVars]![MyVar]<>0

MessageBox

Message: ="You entered " & [TempVars]![MyVar] & "."Beep: YesType: Information

RemoveAllTempVars