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

How to declare a global variable

Status
Not open for further replies.

KentMorand

Technical User
Joined
Feb 27, 2002
Messages
32
Location
US
I know this is an easy one but I've been out of the game for a while and need a little help. When a user chooses a team from a list box on the first form I want that value to be saved (presumably as a global variable) so it can be used in every other form in the database. Currently I am basing forms on queries and passing the value of the list box into the query but this seems kind of messy. Any help would be appreciated.
 
Create a code module. Type Public VariableName As , then type/select your base type. Save you code module, calling it something like 'Public Variables'.

e.g.
Public MyString As String

Be aware though, that if your code breaks in any unhandled errors and you have to reset you will lose the values of your variables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top