-
February 26th, 2003, 07:11 PM
#1
“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
Run-time Error
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
Else
CheckLinks = False
Exit Function
End If
End Function
-
February 26th, 2003, 11:45 PM
#2
May be you might have set the "break on all errors" option in the vb6 IDE.
check it out.
regards
madhu
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|