bigracefan
Programmer
I've got an application that runs 24/7. Everything works fine except that on Sundays we do a backup of the database. So the application looses it's connection to the database. So far we need to restart the application after the database is available. I've got the following routine, but it doesn't seem to work. I get the following error message: Operation is not allowed when the object is open.
Here is what I have:
error traping in subs and functions
If Err.number = 3704 Or InStr(1, Err.Description, "ORA") > 1 Then
While Reconnect = False
With frmMessage
.Message = "Trying to reconnect to database"
.Show 1
End With
Wend
Call Form_Load
Exit Function
End If
Public Function Reconnect() As Boolean
'sets the connection locations for security and the ECU tables
Dim Constr As String
On Error GoTo Reconnect_Trap
ReTry:
Constr = "Provider=MSDAORA.1;Password=MyPassword;User ID=MyUserName;Data Source=" & gServer & ";Persist Security Info = True"
gConnect.Open (Constr)
Exit Function
Reconnect_Trap:
If Err.number <> 0 Then
If Err.number = 3705 Then 'already connected
Reconnect = True
Else
Reconnect = False
End If
Else
Reconnect = True 'not connected
End If
End Function
Here is what I have:
error traping in subs and functions
If Err.number = 3704 Or InStr(1, Err.Description, "ORA") > 1 Then
While Reconnect = False
With frmMessage
.Message = "Trying to reconnect to database"
.Show 1
End With
Wend
Call Form_Load
Exit Function
End If
Public Function Reconnect() As Boolean
'sets the connection locations for security and the ECU tables
Dim Constr As String
On Error GoTo Reconnect_Trap
ReTry:
Constr = "Provider=MSDAORA.1;Password=MyPassword;User ID=MyUserName;Data Source=" & gServer & ";Persist Security Info = True"
gConnect.Open (Constr)
Exit Function
Reconnect_Trap:
If Err.number <> 0 Then
If Err.number = 3705 Then 'already connected
Reconnect = True
Else
Reconnect = False
End If
Else
Reconnect = True 'not connected
End If
End Function