Global Variables Access 97

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I'm trying to declare a global/public variable in a vba module of a specific
form so that the information contained can be read into a text box on another
form.

Any ideas anyone ?

Thanks for any help in advance.
 
If the form closes, then the variables will NOT exist anymore. (this is
called going out of scope).

So, if the form is still open, then simply reference the field you need.

forms!TheForm!ThetxtContorl

And, if for some strange reasons, you do in fact need to use the variable,
then you must prefix it with form name.

forms!TheOtherForm.MyGlobalVar

However, if the form is NOT opened, then your global var will NOT be
available.

You can either declare a global var in a standard module (and then have both
forms use that). When you do this, then no forms qualification is needed.


Or, as mentioned if the form is opened, then qualify the var as above

You can also pass a value from one form to anther via open args
 
Back
Top