Variable Scope

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

I need a variable available to several procedures in a report, but not
visible to the rest of the world. Do I just put:


Private MyVariable as Integer

at the top of the code (same level as the procedures)? Or do I use the
"Public" qualifier? But wouldn't that make it visible across all the
modules?

Thanks!


Don
 
Don said:
I need a variable available to several procedures in a report, but not
visible to the rest of the world. Do I just put:


Private MyVariable as Integer

at the top of the code (same level as the procedures)? Or do I use
the "Public" qualifier? But wouldn't that make it visible across all
the modules?

In the top of the Report module (no "Public")
 
Using Private at the top of the report module will make the variable
available within the module. Using Public would make it available from
anywhere, if the report is open. So, you'd be correct to use Private.
 
Back
Top