Solved

vba error code not catching error number

Posted on 2014-04-09
4
363 Views
Last Modified: 2014-04-09
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
0
Comment
Question by:fordraiders
4 Comments
 
LVL 26

Accepted Solution

by:
MacroShadow earned 250 total points
ID: 39989319
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
 
LVL 45

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
ID: 39989487
Please show the complete procedure that contains that code.
0
 
LVL 33

Expert Comment

by:Norie
ID: 39989566
Perhaps some other error has occured before the 424 error you expect?
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 39990732
Thanks..commented and found a previous error.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now