vba error code not catching error number

vba 2010.
excel

I have code that is to capture a specific error number.

It is not catching the error 424 ?


ErrHandler:
If Err.number = 424 Then
         MsgBox "You May Have Data that Contains Extra Special Characters.Please Verify Your Cut and Paste or Typing entry.", vbCritical, "Description Search Error" 'On Error Resume Next
    rs.Close
     db.Close
       Set rs = Nothing
         Set db = Nothing
           UserForm2.ListBox47.Clear
Exit Sub
End If



Thanks
fordraiders
LVL 3
FordraidersAsked:
Who is Participating?
 
MacroShadowConnect With a Mentor Commented:
If you comment the error handling do you run into an error? If so type in the immediate window (ctrl+G to open it):
?Err.Number
Hit enter. What is the number?

Alternatively attach a sample so we can debug it.
0
 
Martin LissConnect With a Mentor Older than dirtCommented:
Please show the complete procedure that contains that code.
0
 
NorieVBA ExpertCommented:
Perhaps some other error has occured before the 424 error you expect?
0
 
FordraidersAuthor Commented:
Thanks..commented and found a previous error.
0
All Courses

From novice to tech pro — start learning today.