Loss of Global Variables

K

kevin

I have attempted to use global variables within an
application I am working on and have a problem with the
variables being blown away in the event of an error. Even
a planned error that is properly trapped will cause this
to happen. I then have to shut the application down and
restart to reset the variables. Why and how can I prevent
this. My solution to date is to put fields on a hidden
form that is always open. This works and I do not lose the
assigned values, but I would rather use variables in code.
 
R

Rick Brandt

kevin said:
I have attempted to use global variables within an
application I am working on and have a problem with the
variables being blown away in the event of an error. Even
a planned error that is properly trapped will cause this
to happen. I then have to shut the application down and
restart to reset the variables. Why and how can I prevent
this. My solution to date is to put fields on a hidden
form that is always open. This works and I do not lose the
assigned values, but I would rather use variables in code.


My understanding of this issue is that it should only occur with untrapped
errors. Also if you distribute an MDE to your users that should solve the
problem. I have seen other posts that indicate that MDE files do not lose
their global variable values upon errors the way MDBs do.

Otherwise your hidden form solution is a popular alternative.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top