Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC and Time out

Status
Not open for further replies.

MaddogC

Programmer
Dec 4, 2003
134
GB
I have an access DB that connects to SQL Server Linked tables. The db will be on a laptop and disconnected from SQL Server for a time. When the laptop is reconnected to the network, I want a 'synchronise' button to test the connection to sql server again.

At present I use the DAO refreshlink method and try and trap any errors using the following code, however when the connection cannot connect and times out I get the SQL Server LOGIN box and a connection fail message instead of my error trapping. How can I get round this problem?

On Error GoTo Err_Attachments

strConnect = "ODBC;DRIVER={SQL Server};SERVER=server1;DATABASE=MYDB;UID=user;PWD=password;"

Set dbCurr = CurrentDb()
Set tdfLocal = dbCurr.TableDefs(strTbl)

With tdfLocal
.Connect = strConnect
.RefreshLink
End With
CheckAttachments = True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top