Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Re: Defining variables


Message #1 by "Mavin Specimen" <mspecimen@h...> on Tue, 09 Oct 2001 18:48:13
If I define a global variable in a forms General Declaration, will that 

variable\value be recognized in the code of a report residing in the same 

mdb?

Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Tue, 09 Oct 2001 15:00:48 -0700
Form and Report modules are special types of class modules.



When you declare a public var in a class module (global means the same thing

as public), it is exposed to the outside world as if it were a property.



So for instance if you had a form named frmMyForm, which had a public

variable called g_intMyVar then *if the form was open* you could get the

value of g_intMyVar from another module with a statement like:



   intLocalVersion = Form_frmMyForm.g_intMyVar

or:

   intLocalVersion = Application.Forms("frmMyForm").g_intMyVar



Compare, public variables declared in regular old modules, which you can use

pretty much anyplace.



HTH,



-Roy



Roy Pardee

Programmer/Analyst

SWFPAC Lockheed Martin IT

(xxx) xxx-xxxx



-----Original Message-----

From: Mavin Specimen [mailto:mspecimen@h...]

Sent: Tuesday, October 09, 2001 11:47 AM

To: Access

Subject: [access] Re: Defining variables





If I define a global variable in a forms General Declaration, will that 

variable\value be recognized in the code of a report residing in the same 

mdb?




  Return to Index