Variables suddenly lose their set values

Why would variables suddenly lose their values when  form loads?  I have a variable that I set to 'true' when the form loads... and I check it at different stages using a message box.  It remains 'true' all the way through the code.   The variable is then used in the after_update of a textbox... when I put a value in the textbox, the variable is gone... somehow it is getting wiped and I can't figure out why...  other ones (global) that are either set on previous forms also disappear.   This was all working up until yesterday...so it has to be something I did yesterday, but I am at a loss as to what it could be.

Are there any certain things I should check that might cause variables to lose their values suddenly?


Thanks
snyperjAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
You already have this right

http://www.rickworld.com/products.html#Find%20and%20Replace%209.0

?

If not, get it ... and then search for all occurrences of that variable ...

mx
0
 
mbizupCommented:
Did you add a "Stop" statement anywhere in your code recently?  That causes all globals to be lost.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Actually, Stop does not clear variables:

From Help:
"The Stop statement suspends execution, but unlike End, it doesn't close any files or clear variables, unless it is in a compiled executable (.exe) file."

Where are this Globals located?  In a vba module? Form module?

mx
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Also ... does you code compile?

Are any errors occurring ... and then End is being hit?  End will clear variables.

mx
0
 
snyperjAuthor Commented:
No stop  and the globals are in a vba module.

The code does compile.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Can you single step through the code .. .from the point where the variable is set ... to where it's gone?

mx
0
 
mbizupConnect With a Mentor Commented:
Do you have any code that deals with forms in design view?

That *might* affect your globals..

Just hazarding some wild guesses here, but we may be able to come up with something more concrete if you post your database (with any sensitive data masked or removed, please :) )
0
 
snyperjAuthor Commented:
I would post it but the .mdb is only a front end, the entire be is SQL.
0
 
snyperjAuthor Commented:
I'll find it... it will just probably take all day to back track and slowly remove yesterdays work until it is working again. groan.. is it 5pm yet?
0
 
snyperjAuthor Commented:
Thanks, I'll get it because I am sure it is helpful...but in this case it is all variables that were previously set that are getting wiped..
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"I am sure it is helpful.."
I promise ... more than you can know :-)

mx
0
 
snyperjAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.