?
Solved

Error Handler

Posted on 2003-12-04
4
Medium Priority
?
293 Views
Last Modified: 2012-05-04
Hello All,

Any ideas to why my application won't read my error handler routine? In other words, I place some bad code, but Visual Basic error code appears and I can't get it to default to my error handler. Has something changed in the VB IDE? HELP. ADawn

On Error Goto ErrorHandler

     'Somewhere in here place bad code...

Exit_ErrorHandler:
Exit Sub
 
ErrorHandler:
 
  MsgBox "I_Should_See_This_Message"   'If working, I should see this message
 
  Call PublicMessengerErrors        
  Call ErrorLogger("cmdButtons_Click")
  Resume Exit_ErrorHandler
 
End Sub
0
Comment
Question by:ADawn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 200 total points
ID: 9873936
Right-click anywhere in the code editor where it is blank, select Toggle, then Break in class module.
0
 

Author Comment

by:ADawn
ID: 9873965
I think I found the problem. In the VB IDE there is a selection in Options: "Break On All Errors." I deselected this option (I selected: Break On Class Module) and now my code is read.

Question: Which option should be selected when I finally compile and distribute my application?

Thanks to All, ADawn.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9873995
>>Which option should be selected when I finally compile and distribute my application

I doesn't matter, this only affect VB IDE not the compile version
0
 
LVL 4

Expert Comment

by:PBuck
ID: 9875111
One more note which you may already be aware of?  But if you are calling other procedures without error handling then VB errors will appear.

So ...

Private Sub TestMe()
   On Error Goto err_Handler
   Call AnotherTest
   Exit sub

err_Handler:
   MsgBox "I see it!"
End Sub

Private Sub AnotherTest()
   Err.Raise 13
End Sub

Hope this helps
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

764 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