Trapping errors and creating custom error messages

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

Guest

As a means of making things easier for those responsible for maintaining
systems, when an error is caught, I would like to display an error message to
the user stating:

1. Form/Report which throws the error;
2. Subroutine which throws the error;
3. Error number; and
4. Error message text.

The caveat is that I would have no way of knowing what type of error is
being thrown. Needless to say, I am a strict adherent to Thomas' Corollary
to Murphy's Law ("Murphy was an optimist.")

I have not been able to find anything on this board or in the literature to
help.

Thanks in advance for your help.
 
To achieve your goal, you need to add error handling to each procedure in
your database.

Each error handler can call a function that actually processes the error,
passing in the name of the object, the name of the procedure, the Error
number, and the error message. The function can the process the error in
whatever way you desire, e.g. ignoring error 2501, or replacing some of the
cryptic messages with more friendly ones. If you wish it can also log the
error to a table.

For an example, see:
Error Handling in VBA
at:
http://members.iinet.net.au/~allenbrowne/ser-23a.html
 
Allen:

Thank you. I think I can go from here.

Allen Browne said:
To achieve your goal, you need to add error handling to each procedure in
your database.

Each error handler can call a function that actually processes the error,
passing in the name of the object, the name of the procedure, the Error
number, and the error message. The function can the process the error in
whatever way you desire, e.g. ignoring error 2501, or replacing some of the
cryptic messages with more friendly ones. If you wish it can also log the
error to a table.

For an example, see:
Error Handling in VBA
at:
http://members.iinet.net.au/~allenbrowne/ser-23a.html
 
Back
Top