Application not shuting down normally.
Posted on 2002-04-16
I created an application that connects to an Access database using ADO. The problem I have is: If I use the application's File->Exit menu, the apllication always stays in memory. I have to press ALT-CTRL-DEL to end it's task. If I use the control menu (or the X at the top right corner of the form) I get an application error in Windows and the application terminates abnormally. What could be the problem?
The Database connection is declared in the Declarations area as:
Dim dbConn as New ADODB.Connection
The code in the exit menu is:
My Form_QueryUnlod(Cancel as Integer) event is as follows:
Private Sub Form_QueryUnload(Cancel As Integer)
If MsgBox("Are you sure you want to exit this application?=vbno Then
Cancel = True
The Form_Unload event contains this code:
Private Sub Form_Unload()
Dim f As Form
For Each f in Forms
If f.Name <> Me.Name then Unload f
set dbConn = Nothing