Eileen Murphy
asked on
Error not being trapped
*** The below error 3265 doesn't result in the code hitting the Err_Proc -- it breaks on the line with the error...
Private Sub DeleteLinks()
On Error GoTo Err_Proc
Dim db As DAO.Database
Dim td As DAO.TableDef
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set td = db.TableDefs("tblODBCDataS ources")
Set rs = td.OpenRecordset
Do Until rs.EOF = True
db.TableDefs.Delete rs!LocalTableName <---------
rs.MoveNext
Loop
rs.Close
Exit_Proc:
Exit Sub
Err_Proc:
Select Case Err.Number
Case 3265 'item not found in this collection *** Should be getting trapped here
Resume Next
Case Else
MsgBox Err.Number & "--" & Err.Description, vbCritical
Resume Exit_Proc
End Select
End Sub
Private Sub DeleteLinks()
On Error GoTo Err_Proc
Dim db As DAO.Database
Dim td As DAO.TableDef
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set td = db.TableDefs("tblODBCDataS
Set rs = td.OpenRecordset
Do Until rs.EOF = True
db.TableDefs.Delete rs!LocalTableName <---------
rs.MoveNext
Loop
rs.Close
Exit_Proc:
Exit Sub
Err_Proc:
Select Case Err.Number
Case 3265 'item not found in this collection *** Should be getting trapped here
Resume Next
Case Else
MsgBox Err.Number & "--" & Err.Description, vbCritical
Resume Exit_Proc
End Select
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
VBA editor>>Tools>>Options ... General
ASKER
Oh for heaven's sake.... I'm a dork. Should have checked that. That was the problem. Thanks a lot!!