You may have classes/controls that do not unload properly and therefore keeping your form from being able to actually unload. In other words; you have a leak......
If possible, log the creation and destruction of forms/classes to a file. Once you think the program should be done check the log for forms or classes that are not being released.
END should never be used in a VB app. It is like getting out of a car while it is still moving. Sure, you'll stop, but whatever else that's moving will keep moving. Objects that have been created (particularly instances of OFFICE) will remain running until you kill them, or reboot.
This could use up all your memory and crash your system.
>As a last resort
Example: the program has to be finished now to be shown to the boss and the fact that the program is not closing is the one big obvious problem he/she should not see. 2 hours after the presentation, when the adrenaline is settling down, you look at the code, destroy all the objects and everyone lives happily ever after =>As a last resort.
-Max
be sure to close all objects declared on each forms of your project... eg. opened recordsets... because even if you've unloaded your form, some of the objects you've declared within it will still remain unreleased...
see example below...
dim mRS as new adodb.recordset
.
.
.
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next
mRS.close
Set mRS = Nothing
err.clear
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.