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

Global Variables

Status
Not open for further replies.
Jun 26, 2001
41
US
Does any one know how to declare a variable that can be used by one than one form.

Example:

I have a main form where when the user clicks on a text box then a pop-up menu comes up which then displays data depending on what was selecting on that field. Then I want whatever is selected to be placed into a text box on the main form.

I don't know how or if it is even possible to declare a variable that can be shared by more than one form.

Byron
 
Go to the Modules tab of the database window. Create a new module. Under the Option Explicit line declare your varible like so...

Public intX as Interger (or what ever type you desire)

One warning. Be careful of the name that you use. Be sure it is unique as you may cause problems in other modules in your database.

B-)

ljprodev@yahoo.com
ProDev, MS Access Applications
 
I usually preface any global variable names with gvar as it helps to ensure that no other variables get squashed by the globals.

Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top