Error Handling?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

I have a program that runs every 5 minutes 24/7. One of the tables I use is
a linked table. During the night some maintenance is being done to this
table which causes the program to get the "Run-time error 3146". I tend to
omit error handling (I know, not wise) and hadn't used it much.

Questions:

1. Is there a way to capture the error message and put it in a table?

2. Can I do things based upon the error message, i.e. error = LikeThisError
then?

3. Can I keep the program going without displaying the error message?
 
See:
Error Handling in VBA
at:
http://allenbrowne.com/ser-23a.html

The article explains how to:
- create a table to log the errors to,
- create a generic function to handle the errors,
- optionally suppress showing the error message, so processing can continue.
 
Mark said:
Hello all,

I have a program that runs every 5 minutes 24/7. One of the tables I use
is
a linked table. During the night some maintenance is being done to this
table which causes the program to get the "Run-time error 3146". I tend
to
omit error handling (I know, not wise) and hadn't used it much.

Questions:

1. Is there a way to capture the error message and put it in a table?

Yes, "Err.Description" and "Err.Number" I find useful.
2. Can I do things based upon the error message, i.e. error =
LikeThisError
then?

Yes, evaluate Err.Number in an IF statement.
3. Can I keep the program going without displaying the error message?

Yes, "On Error Resume Next" is the bull-in-a-china-shop method. Actually I
think someone might correct me on this, I'm not too sure about run-time
errors in this context ...

Regards,
Keith.
www.keithwilby.com
 
Back
Top