H
Harish
Hi All
I have a trouble here to handle database connection error.
Basically I have a program which runs 24 hours and 7 days a week
continuously. In this program I connect to the database and retrieve the data
after every 15 minutes. But sometime there is database connection error and
which stops the program forever. Because it open the database window and ask
to select the datasource, until someone click OK, program doesn’t start. I
have used error handling function but it doesn’t stop to open that database
window.
Here is the Code:
Option Explicit
Sub Macro2()
Code
On Error GoTo Stoprogram
With Selection.QueryTable
.Connection = ODBC;DSN=ABCD;UID=user;PWD=password;SERVER=xyz;"
On Error GoTo Stoprogram
.Refresh BackgroundQuery:=False
End With
Code
Stoprogram:
End Sub
Your help would be greatly appreciated.
Thanks
Harish
I have a trouble here to handle database connection error.
Basically I have a program which runs 24 hours and 7 days a week
continuously. In this program I connect to the database and retrieve the data
after every 15 minutes. But sometime there is database connection error and
which stops the program forever. Because it open the database window and ask
to select the datasource, until someone click OK, program doesn’t start. I
have used error handling function but it doesn’t stop to open that database
window.
Here is the Code:
Option Explicit
Sub Macro2()
Code
On Error GoTo Stoprogram
With Selection.QueryTable
.Connection = ODBC;DSN=ABCD;UID=user;PWD=password;SERVER=xyz;"
On Error GoTo Stoprogram
.Refresh BackgroundQuery:=False
End With
Code
Stoprogram:
End Sub
Your help would be greatly appreciated.
Thanks
Harish