|
-
May 2nd, 2005, 12:18 AM
#6
Re: On Error for a project
I think you can just do this...:
Code:
Sub Main
On Error GoTo Global_Error_Handler
' Open form/do stuff
Exit Sub
Global_Error_Handler:
'handle errors
End Sub
Now, I think the best way to do that would be to make an error handler class object that does that which is declared and instantiated globally. Then you could (if you wanted) have a public property of that class which could contain the state of your program (i.e. any information regarding what section the code is currently in, etc) and set within the bulk of your code. Then, the error handler class could handle generic errors, but also be able to customise (i.e. numeric overflow errors are fine in some places, but need to be handled differently in your invoice totals calculations (for example)). After the "Global_Error_Handler" label, you could then just call the error handlers "handle" (example) method - which could maybe return true or false, depending on whether the error is critical or execution can resume.
Hope I've made sense
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|