Unanswered: “On Error Resume Next” can no longer catch the error
“On Error Resume Next” can no longer catch the error.
In using Access 2000.
I am using the following code to test and see whether I can my application can still see the tables that are linked to it. If it cannot, then it has to get linked. There is a possibility that an error will occur if sat the “Back-End” database moved. I am using the code below to catch the error. This code has been working for sometime but then all over a sudden, “On Error Resume Next” can no longer catch the error; I get the
Invalid SQL statement: expected 'Delete', 'insert','Procedure','select' or 'update'
Any one out there with a solution:
Public Function CheckLinks() As Boolean
' Check links to the AFCIO database
' Returns true if links are OK.
Dim rst As ADODB.Recordset
Dim someString As String
' This is very important, other wise if you try ot open a table that
' does not exist, the error would end the app. But because of
' "On Error Resume Next", one can continue.
' Open backend linked table to see if connection information is correct.
On Error Resume Next
Set rst = New ADODB.Recordset
rst.Open "tblCountry", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
someString = rst!CountryID
' If there's no error, return True.
If Err = 0 Then
CheckLinks = True
CheckLinks = False