Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using global variables

Status
Not open for further replies.

rry2k

Programmer
Jun 28, 2001
678
US
Hi,
I'm trying to set-up and pass info from one form to another using a global variable. The info is in the variable when I leave form one but doesn't get passed on the form load event in form 2. There was a module out there called module one that I defined the variable in. I'm not sure I did that right so that might be the problem or the module isn't being called. Please help

Thanks..Russ
 
Hi Russ!

For a variable to be global, it must be declared as Public in a module, but outside of any function or procedure. A more stable way of passing the variable is with OpenArgs property of the OpenForm method. Another alternative to the global variable is to have a hidden form open with a text box on it where you can store the variable.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Hi Jeff,
I tried dim vartest as and public wasn't an option in the intelesence. Is dim wrong?

Thanks..Russ
 
If I remember right, you need to use the static keyword to maintain the value of the variable between procedures. The Public declaration just makes the variable available to all procedures.

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top