On Error

  • Thread starter Thread starter Mary Fetsch
  • Start date Start date
M

Mary Fetsch

In my Access 2000 project, I have some On Error statements in the following
format:

On Error Goto CheckYear
Line A Code
Line B Code
Line C Code

CheckYear:
On Error Goto 0
On Error Goto Continue
Line D Code
Line E Code

Continue:

When there is an error in the Line D code, the "On Error Goto Continue" line
is being ignored, and I'm getting a system error. The On Error statements
work fine independantly, but when I use them together, the last one fails.

I'll appreciate any help anyone can give me on this.

Mary Fetsch
 
According to the 'On Error' topic in the help file ...

<quote>
If an error occurs while an error handler is active (between the occurrence
of the error and a Resume, Exit Sub, Exit Function, or Exit Property
statement), the current procedure's error handler can't handle the error
</quote>

When your line D executes, your CheckYear error handler is still active, and
therefore this procedure can not handle the error.

You need to write your code in such a way that it is not possible for a
predictable error to occur within an active error handler.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Thanks for your help!

Brendan Reynolds said:
According to the 'On Error' topic in the help file ...

<quote>
If an error occurs while an error handler is active (between the occurrence
of the error and a Resume, Exit Sub, Exit Function, or Exit Property
statement), the current procedure's error handler can't handle the error
</quote>

When your line D executes, your CheckYear error handler is still active, and
therefore this procedure can not handle the error.

You need to write your code in such a way that it is not possible for a
predictable error to occur within an active error handler.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Back
Top