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!

Another Global Variables Question

Status
Not open for further replies.

Scott2S

Technical User
Oct 27, 2000
48
US
Are global variables handled the same in VBA Access 97 as they are in VB 6.0?

The reason I ask is that I recently converted an older access database written by someone else years ago and the code is riddled with statements that check to see if global variables are set. If they are not set, the application will give the user an error message. This happens a lot and the user has to restart the application (by the way this error happens randomly and happened before I converted the application)

I am trying to get my arms around this problem, but am having difficulty. The first question that I have is why would a programmer want to check if global variables are set?

Second, how does the global variables setting get reset randomly in this code?
 
Gotta be alittle more specific for me, maybe some code snippets

Collin
 
I jumped the gun on posting this. I have to do a little more analysis here and I will repost.

For some strange reason there is a standard module with a public function that checks to see if global variables are set. This makes no sense. A global variable is a global variable all the time and shouldn't just change state, right?
 
Unless the variable is declared as a constant you should expect it to change when necessary. That's why it's called a "variable".

Why don't you go into that nasty old module and do a search for each of the variable names to see what they are used for. That should at least answer the question of why the program self-aborts if the variables aren't given a value. My guess is that there are subroutines that won't work properly if certain conditions aren't met.

It sounds very much like the code was a "work in progress" that was never quite finished.


VCA.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top