Solved

vba error code not catching error number

Posted on 2014-04-09
4
366 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 27

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 46

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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