Error Handling

D

Duncan Edment

I've a couple of questions about error handling.

1. Is it possible to define a global error handling procedure, that all error
can be routed through?

2. After the error has been handled--all I am doing is writing the error to an
error log table--what's the best thing to do? Is it best to exit the procedure
totally, or should I continue, using 'Resume Next', with the procedure that
generated the error?

Your help / advice is, as always, appreciated.

Rgds

Duncan
 
W

Wayne Morgan

1) The On Error GoTo statement will take you to a tag in your current procedure. From
there, you should be able to call a Sub or Function in a module, passing the appropriate
parameters, such as Err.Number. However, most error handlers are likely to be so short, I
don't know if you'll be gaining much as far as reducing your typing goes. You may find it
easier to just copy and paste in each routine.

2) What you do after the error depends on the error and what you want to do. Sometimes you
want to ignore the error, sometimes you may want to have the user correct something then
try again (i.e. trying to write to a floppy, advise the user there is no disk present and
to insert one and try again), sometimes you may want to fix something yourself and try
again, and sometimes you need to just cry "uncle", pop-up an error message, and bail out
of the procedure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top