O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9.6. Issues in Error Handling

Some developers try to enhance their error handling with writing log files or sending e-mail. There are some issues involved with these error-handling techniques, as explained in the following sections.

9.6.1. Don't Use Error Handling with Logging

Some developers write code to insert an error log record into a table or text file when an error occurs. The idea is to be able to analyze when and where errors have occurred by querying this table long after the errors happened. However, this technique has some issues.

  • Access does not provide a way to determine the name of the procedure that is currently running. Because any error logging routine needs to know which procedure caused the error, you need to manually code the name of the current procedure into each error routine. That is labor intensive and prone to errors.

  • The benefit of error logging is questionable because few errors should be happening after your code has been tested and delivered. Errors should be rare enough that your users will let you know when they happen. You can always ask them to capture a screenshot if you want to see the details.

  • Some types of errors cause the attempt to log them to fail. Examples include loss of network connectivity, and disconnected storage hardware. Your user may see additional unrelated errors, or you could be lulled into thinking that all errors are logged, when they may not be.

If your code is running in a managed environment, it may be beneficial to log ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required