I need to check (through VBA) if a linked table is online or not. The linked table is attached to a SQL server using an ODBC connection string. If the server is offline or unreachable is what I am using to trigger other code.
Anyone have ideas? I have been googling all morning with little luck.
I did find http://www.vbaexpress.com/forum/showthread.php?t=17777 which looks like what I need but I cant get it to work. I just get a
"Run time error ODBC driver manager data source name not found and no default driver specified"
Anyone have ideas? I have been googling all morning with little luck.
I did find http://www.vbaexpress.com/forum/showthread.php?t=17777 which looks like what I need but I cant get it to work. I just get a
"Run time error ODBC driver manager data source name not found and no default driver specified"
Code:
Private Sub Form_Load()
Dim curtbl As String
Dim con
curtbl = CurrentDb.TableDefs("help table").Connect
Set con = CreateObject("ADODB.Connection")
con.Open curtbl
con.Close
Set con = Nothing
con_Exit:
Exit Sub
con_error:
MsgBox con
'Run linkDB()
Resume
End Sub