I have a button in an MS Access form that launches a SQL server SP Async. The users can the view the form for status update on a log table that is set to refresh per form Timer(). User can also open other MS Access forms to run other processes.
Question: How can I properly close the ADO DBConn Connection? I think it remains open until I close the form. I would rather be clean and close after the Log table is updated with Finished; perhaps close the DBConn in Timer()? But, object is not
I thought I would somehow check connection state in Timer(); and then check if log table is filled with Finished status for process. But DBConn is not valid?
Any assistance is appreciated... tia,
Steve Medvid
IT Consultant & Web Master
Question: How can I properly close the ADO DBConn Connection? I think it remains open until I close the form. I would rather be clean and close after the Log table is updated with Finished; perhaps close the DBConn in Timer()? But, object is not
Code:
Private Sub cmd_Run_Report1_Click()
Dim DBConn As New ADODB.Connection
...
DBConn.ConnectionString = AutoExec.APTConnect
DBConn.CommandTimeout = 0
DBConn.ConnectionTimeout = 0
DBConn.Open
...
lcSQL = "EXEC APOLY.sp_Build_Report1 " & lcParameters
DBConn.Execute lcSQL, , adAsyncExecute
...
I thought I would somehow check connection state in Timer(); and then check if log table is filled with Finished status for process. But DBConn is not valid?
Code:
Private Sub Form_Timer()
...
If DBConn.State <> adStateOpen Then
MsgBox ("HERE")
End If
...
Any assistance is appreciated... tia,
Steve Medvid
IT Consultant & Web Master