Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form level objects and variables losing values

Status
Not open for further replies.

SeeThru

IS-IT--Management
May 2, 2002
585
GB
Hi All

I've got a couple of forms that use form level variables, delared in the module header - one is an object created from an imported ActiveX DLL that's for TAPI control, the others are standard variables used to set default values and control record saving.

They are generally set on form open or when a filter is applied.

The weird thing is that the objects and variables regullary seem to go out of scope, altohugh the form is open - this causes trapable errors 'object does not exist'.

The database is Access97, running off a network share, and there could be two or three users in it, although it is generally just one. Note the db is a single file (not FE/BE) because splitting it caused too many problems.

SeeThru
Synergy Connections Ltd - Telemarketing Services
 
I have a similar problem which I can explain...

I have a database which declares a global variable to hold the user ID for the session. This variable goes out of scope when ever a runtime error occurs. Because I use the MDB file (not MDE) the error is caught by Access and I am allowed to debug or continue but once this happens, the user ID is lost.

Could your problem be similar?
 
Yes - it could indeed!

I use error trapping to bypass errors I know are likely - however, if error trapping invalidates any current variables/objects it could explain it.

Anyone else know if ALL errors cause this, or just unhandled errors? I have onError in most events, and sometimes cases for specific events. Acc97 doesnt have the Try.. loops.

SeeThru
Synergy Connections Ltd - Telemarketing Services
 
All global variables are reset when the VBAProject is reset.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
What would trigger the reset of the VBA project? Obviously a form close and reopen does, as does entering break mode.

What about handled errors?
Form requery (or just calling the On_Load)?

These variables seem to randomly dissapear, with no apparent pattern - it always works fine on my test system, but gives intermittend fails on production.

SeeThru
Synergy Connections Ltd - Telemarketing Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top