Error Handler 
Author Message
 Error Handler

What about using an error handler?

....
On error GOTO ErrHndlr
....
Exit sub
ErrHndlr:
    Select Case Err
        Case 'whatever err you anticipate
            'get out of whatever loop or tell the user what happened
            'so you can handle groups or single errors
            ....
            err.clear
        Case Else
            MsgBox "An unanticipated error has occurred: " & vbcrlf &
"ERROR#:  " & Err.Number & _
                vbCRLF & Err.Description",
vbInformation,App.Title,Err.HelpFile, Err.HelpContext
            'Comment out the STOP and RESUME before distribution, these will
let you locate the error
            Stop
            Resume
            'Do whatever you want to do with unknown errors, I usually END
the application after writing to a textfile             'the info of the
error, date, and where it happened - I don't usually trust the User for this
            WriteErrorToTextfile
            Err.Clear
            End
    End Select



Fri, 02 Nov 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ERROR HANDLERS RUNNING WITHOUT ERRORS

2. Error Handler -- Getting Line Number of error

3. Error Handler - How to get line number where error occurred

4. Error handling in an error handler?

5. error handler not capturing error??

6. error occurring within error handler

7. vba error handler

8. VBA 6.0 error handler bug

9. Error handler

10. Error handler question

11. VBA Error Handler add-in will not update in Access 2000, Visual Basic Editor

12. Need help with debug/error handlers

 

 
Powered by phpBB® Forum Software