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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing variables 1

Status
Not open for further replies.

billheath

Technical User
Mar 17, 2000
299
US
I have declared 2 variables, VArea and VapLevel as public in a general module. When I try to use the two variables in opening a form (In the ON Open Event), Access remembers Vaplevel bot not VArea. Both are declared as pulic on the same line. Both values are entered as inputs on 2 consecutive opening forms. Any ideas why one will work but not the other? Is there a sure proof method of carying variables from one module to another?

Thanks, Bill
 
Hi Bill!
How about:

Global VArea as something
Global VapLevel as something

They'll stick for good, just don't forget to get a value in to them someway... ;-) Gord
ghubbell@total.net
 
GHUBBELL,
I tried setting the variables as global. But, when I try to use them in a form module, Access still identifies them as Varea=null. I followed the execution one step at a time. As long as the code being executed is in one of the general modules, both variables are identified.
Before I changed them to global, one of them Vaplevel would carry its value to the form. Now, both of them read null.

This is confusing!!
Thanks, Bill
 
Hi Bill,
How are you setting your value in to the variable?

If you have:
Global Varea as Variant

then somewhere you must have
Varea = 1234567 or whatever
or maybe in an after update event: Varea = Forms!formName![FieldOnForm]?
May I see your code? :cool: Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top