How to use global variables?

  • Thread starter Thread starter JasonS
  • Start date Start date
J

JasonS

Hello!
Can anybody help with this?
I created a form (Form1) on which there is a field called UserID. The value
of it is set to a global variable that will be used to display detailed user
data on another form.
But I don't know how and where use it...
Second form has such fields (editboxes) as "Street address", "zipcode" etc.
They are placed in a table from which I want certain data to be retrieved
from, and table's primary key is UserID - given in Form1.
Let's say the zipcode value will be retrieved by an SQL statement, but I
don't know now to attach UserID as a part of this query, and secondly, where
to put this query... Should it be BeforeUpdate, AfterUpdate or some other
events? Or maybe Record Source?
Thanx in advance for your help!
 
Global variables need to be declared in a standard module:

Public strSomething as String

This would then be available to all of your code.

If you create a public variable in a class (form) module, it will also be
globally available, but it will only be in scope while the form is open...
 
Back
Top