-
Hi. when I unload a form and go to another like so:
Load frmB
frmB.Show
Unload frmA
I want to be able to nullify all values for any variables that I added to the form. In one app., I found that going back to that page after unloading it and then clicking back in to it (at runtime), it is still holding values assigned from the previous instance.
Ideas?
Thanks
Wengang
-
Yes you are right, any variables declared at form level will not be destroyed when the form is unloaded. To destroy all form variables when the form is unloaded, make sure that the last statement in your Form_Unload routine sets the form to Nothing.
Code:
Private Sub Form_Unload(Cancel As Integer)
'Your Form Unload code in here (if any)
.
.
Set frmA = Nothing
end sub
Cheers
Adrian