I am experiencing what appears to be a memory leak in several of my VB 6.0 applications. To try to identify the problem, I've created a new application, inserted the Beginning form from one of the applications I'm having a problem with. The form has 5 command buttons. Here is the code from the form:
Global dbclass As New ADODB.Connection<--This is defined in a
module called main. It is the only
thing in the module
Private Sub Form_Load()
MakeConnection
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseConnection
End Sub
Private Sub cmdAction_Click(Index As Integer)
Dim MenuOption As String
frmDERMenu.Hide
Select Case Index
Case 0
MenuOption = "STDT"
Case 1
MenuOption = "JOBC"
Case 2
MenuOption = "FREQ"
Case 3 'Exit
Case 4 'Create QUALS file
MenuOption = "QUAL"
End Select
Unload frmDERMenu
End Sub
Sub MakeConnection()
Set dbclass = New ADODB.Connection
'Create the connection.
dbclass.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source = " & App.Path & "\DER.mdb"
dbclass.Open
End Sub
Sub CloseConnection()
dbclass.Close
Set dbclass = Nothing
End Sub
I have the program compiled to a .exe file.
What is happening is I execute the program and display the form and then immediately exit. Then if I wait 1/2 hour to an Hour, and try again to execute the program I get the error:
(myprogram0.exe - Application Error. The instruction at 0x77fab813 referenced memory at 0x00000058. The memory could not be read.
Does anyone see any problem with this code or know of an existing problem with the data access driver?
Thanks for any help you can give me.
Global dbclass As New ADODB.Connection<--This is defined in a
module called main. It is the only
thing in the module
Private Sub Form_Load()
MakeConnection
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseConnection
End Sub
Private Sub cmdAction_Click(Index As Integer)
Dim MenuOption As String
frmDERMenu.Hide
Select Case Index
Case 0
MenuOption = "STDT"
Case 1
MenuOption = "JOBC"
Case 2
MenuOption = "FREQ"
Case 3 'Exit
Case 4 'Create QUALS file
MenuOption = "QUAL"
End Select
Unload frmDERMenu
End Sub
Sub MakeConnection()
Set dbclass = New ADODB.Connection
'Create the connection.
dbclass.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source = " & App.Path & "\DER.mdb"
dbclass.Open
End Sub
Sub CloseConnection()
dbclass.Close
Set dbclass = Nothing
End Sub
I have the program compiled to a .exe file.
What is happening is I execute the program and display the form and then immediately exit. Then if I wait 1/2 hour to an Hour, and try again to execute the program I get the error:
(myprogram0.exe - Application Error. The instruction at 0x77fab813 referenced memory at 0x00000058. The memory could not be read.
Does anyone see any problem with this code or know of an existing problem with the data access driver?
Thanks for any help you can give me.