Solved

Variables suddenly lose their set values

Posted on 2011-09-16
12
315 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:snyperj
  • 5
  • 5
  • 2
12 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 36550411
Did you add a "Stop" statement anywhere in your code recently?  That causes all globals to be lost.
0
 
LVL 75
ID: 36550503
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
 
LVL 75
ID: 36550514
Also ... does you code compile?

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

mx
0
 

Author Comment

by:snyperj
ID: 36550526
No stop  and the globals are in a vba module.

The code does compile.
0
 
LVL 75
ID: 36550592
Can you single step through the code .. .from the point where the variable is set ... to where it's gone?

mx
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 200 total points
ID: 36550593
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:snyperj
ID: 36550621
I would post it but the .mdb is only a front end, the entire be is SQL.
0
 

Author Comment

by:snyperj
ID: 36550631
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
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 300 total points
ID: 36550640
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
 

Author Comment

by:snyperj
ID: 36550667
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
 
LVL 75
ID: 36550685
"I am sure it is helpful.."
I promise ... more than you can know :-)

mx
0
 

Author Closing Comment

by:snyperj
ID: 36561702
Thanks
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now