You may use Tempvars (temporary Global Variables) to store the value and use it in TextBoxes on Forms, Reports, or in VBA.
Example Syntax: Tempvars.Add VariableName, Value
Tempvars.Add "Total",DSum("Amt","QueryName")
To display the Value in Variable 'Total' - assuming the value in variable Total= 1000
? Tempvars!Total
result: 1000
To use the value in a TextBox on a Form as part of an expression.
="Average: " & Tempvars!Total/DCount("*","QueryName")
To remove a specific variable from memory:
Tempvars.Remove Total
To remove all the Tempvars from memory.
Tempvars.RemoveAll
You can assign value to Temporary Variable through Macro Command: SetTempvars "VariableName", Value
You can define several global temporary variables this way and stays valid till you shutdown the database or till you execute individual Remove command or RemoveAll command to remove all the active variables in memory.