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
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