private function is error handling needed

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

Guest

My app will be distributed as a runtime app. I have created a private
function and am wondering if the guru's could advise me if I need to include
error handling in it. I have not observed any error handling in any function
in an Access database, so would appreciate some advice from the pro's. Thanks
in advance.
 
All subroutines, functions, and code need to use error handlers if you plan
to have others use the database! Otherwise, your users are going to have all
kinds of problems when errors occur. Also note that, in the absence of error
handlers, when an error occurs in a called function or subroutine, the error
will be propogated upwards to the calling functions/subroutines until an
error handler is found; else an error will be "shown" in the highest level
procedure (the "first" one in the stack) and you may be completely mystified
by what that error means in that procedure because the error didn't really
occur there. Also, in the absence of error handlers, global variables, form
and report OpenArgs properties, and other things are set to "default" values
when an error occurs... meaning that you may lose important data.

Most code examples do not include error handlers because they're usually
unimportant to what the code example is demonstrating. Some code examples
use them because they're integral to what the code example is demonstrating.

So, always include error handling, even if it's just the use of On Error
Resume Next when that is appropriate.
 
Back
Top