Re: Error Trapping. (A2000)

My routines look something like this. The dbs and rst are just for illustration purposes; I include them because they need to be set to Nothing whether the procedure ends normally or not. In the error trap section, I display the error number (so you can look it up) and description, then resume to the exit section, where the necessary clean up is done. I silently ignore error 2501 - you get this for instance when you cancel the opening of a report because there are no data.

(1) <font color=blue>ExitHere:</font color=blue> is a label. When an error (other than 2501) occurs, an error message is displayed, then the code resumes at the label ExitHere. This makes it possible to execute any necessary rounding up that *must* be done, regardless of whether an error occurred or not. If you don't need any rounding up, you might omit the <font color=blue>ExitHere:</font color=blue> label and the <font color=blue>Resume ExitHere</font color=blue> statement.

(2) <font color=blue>Err<font color=blue> is an object that contains information on the error that occurred. This object has several properties, of which Number and Description are the most important in this situation. Number is the default property; if you just refer to Err, it is assumed that you mean Err.Number. So instead of