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!

Declaring a Variable 2

Status
Not open for further replies.

iamedwardkim

IS-IT--Management
Nov 7, 2002
29
US
How can one declare a variable so that it is accessible from several subroutines?

Basically I have several subroutines which respond to different events (e.g. mouse clicks). I need to be able to access the same variable from all of these subroutines.

Thank you.
 
Hi,

In the area where you open or create tables/forms/reports, you have Modules.

Open a new module and define your var in there.

A module defined variable is accesible from all objects within the whole application.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
You must also declare the variable as PUBLIC. For example,

Instead of:
Dim strTemp As String

It should be:
Public strTemp as String

In every database I create, I create one module (basPublicDeclarations) that contains the definitions of all my global (Public) variables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top