Application Level Error Handling - its very urgent

Posted on 2005-03-25
Medium Priority
Last Modified: 2010-05-02
i need to update some database values when my VB application raises run time error at any part of the application
does VB allow Application level error handling if yes then how can i do this.
Question by:imrancs
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
LVL 53

Expert Comment

ID: 13629601
Do you have any error-logging ?
LVL 32

Assisted Solution

Erick37 earned 400 total points
ID: 13629890
LVL 38

Accepted Solution

PaulHews earned 1200 total points
ID: 13630005
You have to have error handling in every sub, and in that error handling, call a central routine.  (Yeah, that sucks I know.  Don't shoot the messenger please. :)  There are products out there that can help you do this.


These are a couple from a seach on vb error handling automation.

The freeware MZTools addon allows you to add error handling to *new* subs and functions but doesn't do a retrofit.
LVL 38

Assisted Solution

PaulHews earned 1200 total points
ID: 13630022
VB.NET has structured error handling and allows you to catch an exception at the application level if needed.  So if you haven't started your project yet, and you aren't that familiar with vb, .NET etc, you might want to review your options.
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 400 total points
ID: 13642007
VB does have some cascading of errors that should help....

try this
Option Explicit

Private Sub Command1_Click()
    On Error GoTo cmderr
    Exit Sub
    MsgBox "CmdErr:" & Err.Number, vbCritical + vbOKOnly
End Sub

Sub test1()

Err.Raise 27

End Sub

Private Sub Form_Load()

End Sub

You will see that although the error was raised in the routine Test1(), the error was trapped back at Command1_click as there was no local error handler.

I think that if you have a local error trap, but dont want to handle the particular error there, you can call the err.raise method within the local error routine, forcing the error to cascade back to the previous routine in the call stack.


Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

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