Link to home
Start Free TrialLog in
Avatar of Eileen Murphy
Eileen MurphyFlag for United States of America

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("tblODBCDataSources")
    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
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
VBA editor>>Tools>>Options ... General
Avatar of Eileen Murphy

ASKER

Oh for heaven's sake.... I'm a dork. Should have checked that. That was the problem. Thanks a lot!!