Global variable

  • Thread starter Thread starter rcarson
  • Start date Start date
R

rcarson

I have forgotten how to declare a variable in a module as
a global variable whose value can be referenced from a
report, for example.

Any help? Thanks.

Rick
 
I have forgotten how to declare a variable in a module as
a global variable whose value can be referenced from a
report, for example.

Any help? Thanks.

Rick

Declare it at the module level, as Public:

Public gMyVar As ...

If the module is a standard module, that's all you need, and you can
refer to it with

X = gMyVar

If it's a form's class module, a reference to the variable must be
qualified with a reference to the open form; e.g.

X = Forms!MyForm.gMyVar
 
Back
Top