Re: Is David Fenton right about error handling?
- From: "Rick Brandt" <rickbrandt2@xxxxxxxxxxx>
- Date: Wed, 04 Jan 2006 14:11:15 GMT
Tim Marshall wrote:
[snip]
> COnsider a command button whose only purpose is open a form. The form
> to be opened has a number of checks in its on open event. COnsider an
> editing form we *don't* want to open if there is no record selected on
> the continuous for or sub form data*** on the calling form. In the
> frmSetUpWeather form below, the on open event checks for a currently
> selected record (or indeed if there are any records in the calling
> form). If this condition fails, then a msgbox explains the problem
> and cancel = True.
>
> This will always generate a 2501 error from the calling procedure and
> I handle such as shown in the code below. However, this is a lot to
> write (though much of it is simply rote with me), so frequently what
> I do is knowing the only real error will be the 2501, I do this:
[snip]
What I did for this (and for reports) was create a wrapper function for
OpenForm and OpenReport that traps for and ignores error 2501 just as your
second example does. Now I just use that function instead of the normal
ones and I only had to write the "correct" code once instead of hundreds of
times.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
.
- Follow-Ups:
- Re: Is David Fenton right about error handling?
- From: Tim Marshall
- Re: Is David Fenton right about error handling?
- References:
- Is David Fenton right about error handling?
- From: Anthony England
- Re: Is David Fenton right about error handling?
- From: Rick Brandt
- Re: Is David Fenton right about error handling?
- From: David W. Fenton
- Re: Is David Fenton right about error handling?
- From: Rick Brandt
- Re: Is David Fenton right about error handling?
- From: Tim Marshall
- Is David Fenton right about error handling?
- Prev by Date: Re: Creating dynamic sql
- Next by Date: Re: How to automate PaperPort?
- Previous by thread: Re: Is David Fenton right about error handling?
- Next by thread: Re: Is David Fenton right about error handling?
- Index(es):