crash when doing set classForm = nothing using class form with withEvents>>SOLUTION

  • Thread starter Thread starter googleDjango
  • Start date Start date
G

googleDjango

I had the trouble that when using a class module with withEvents,
Access97 crahes when arriving to the statement : set classForm
=nothing

This is due to the fact that the events in the classForm are sent
AFTER the same events in the normal form

If you write in the classForm the terminate event with set
withEventsForm=nothing there is no more reference to the classForm

The events are sent in the order

unload event
then close event

so with the classForm and the normal form it makes

normal form unload event
class form unload event
normal form close event
class form close event

To make things work you have to do

create an unload event in the classForm that will do the neating of
the reference to the withEvents form (set withEventsForm=nothing)
In the normal form in the close event do the cleaning of the classForm
(set classForm = nothing)

So you achieve to prevent memory leaking

This works with Access97 but maybe it's also an issue in 2000+
versions
 
This is a known issue, documented in the MS KB and in many threads here
in the NG's.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Back
Top