Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Global variable resetting

Discussion in 'Information Technology' started by Domac, Jul 28, 2006.

  1. Domac

    Expand Collapse


    When exception (debug or End) occur all of my global variable resets!
    How to prevent it??
  2. Loading...

  3. Tom Wickerath

    Tom Wickerath
    Expand Collapse

    Hi Domac,

    You may not be able to prevent global variables from losing their values,
    but you can do a test just prior to referencing such a variable. Then
    re-initialize the variable as needed. See my second post in this recent


    Tom Wickerath
    Microsoft Access MVP


    "Domac" wrote:

    > Hi,
    > When exception (debug or End) occur all of my global variable resets!
    > How to prevent it??
  4. Larry Linson

    Larry Linson
    Expand Collapse

    "Domac" <domac.kovacevic@zg.t-com.hr> wrote in message
    > Hi,
    > When exception (debug or End) occur
    > all of my global variable resets!
    > How to prevent it??

    Generally, this happens only with "unhandled errors," so a good start would
    be to include error handling everywhere an error could happen. That will
    cover many of the cases, but it may be difficult to determine _all_ the
    possibilities. If it's a production application used by others, it should
    have user-friendly error handling, in any case. If it's your own
    application, then you can live with losing the globals, or use another
    option for storing them than global (Public) variables in a standard module.

    Some other options are: save critical values in Controls on a
    hidden/invisible Form; save the critical values in a Table; save critical
    values in Properties of the database.

    Larry Linson
    Microsoft Access MVP
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     

Share This Page