Solved

Error Handler

Posted on 2003-12-04
4
289 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 50 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBS file using code from 2nd file (txt or vbs) 4 47
MS Access Search and Replace Using VBA 6 92
How to Add / Edit Windows Menu 4 74
Sub or Function is not defined 6 54
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

730 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