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

Initializing a variable in bas module

Status
Not open for further replies.

huBBLe

Programmer
May 15, 2001
50
SG
I need to maintain a global variable which has to be initialized right from the start. I tried to initialize it in my bas module but obviously its not allowed. There is no use putting the variable in any of my forms' load event as the variable will only be initialized when the forms are loaded, which i not what i wanted.

Is there any way or where i can go about to initialize the variable?

Thank You
 
In the Project Properties change the startup object to be Sub Main. In your bas module create a public sub called Main. In this procedure initialise your variables and call the form that you initially had as the startup form.

Madlarry
 
You should be able to initialize in your bas module.

In a bas module....

Option Explicit

Public strYourVariable as string


Private Sub Main()

strYourVariable = "Something"

End Sub


Make sure the Startup Object is Sub Main under project properties
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top