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

    Domac
    Expand Collapse
    Guest

    Hi,

    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
    Guest

    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
    thread:

    http://www.microsoft.com/office/com...cess&mid=c6ccd43a-cd1e-4006-9f09-88035f2b9607


    Tom Wickerath
    Microsoft Access MVP

    http://www.access.qbuilt.com/html/expert_contributors.html
    http://www.access.qbuilt.com/html/search.html
    __________________________________________

    "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
    Guest

    "Domac" <domac.kovacevic@zg.t-com.hr> wrote in message
    news:OyRsDk7rGHA.2464@TK2MSFTNGP03.phx.gbl...
    > 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