Welcome to SPN

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

Sign Up Now!

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
     

Share This Page