Chapter 26: Debugging Your Access Applications


Organizing VBA code

Testing an application

Debugging the traditional way, with MsgBox and Debug.Print

Taking advantage of the debugging tools available in Access

Trapping unexpected errors

Many Access applications rely on significant amounts of VBA code in forms and reports, and as stand-alone modules. Because of its power and flexibility, VBA is used for all aspects of application development, from communicating with the user to massaging and transforming data on its way from tables and queries to forms and reports.

Because VBA code is often complicated (or at least, seems complicated!) debugging an error or problem in an application can be difficult and time-consuming. Depending on how well organized the code is, and whether simple conventions, such as providing descriptive names for variables and procedures, were followed, tracking down even a small coding bug can be a frustrating experience.

Fortunately, Access provides a full complement of debugging tools to make your life easier. These tools not only save time by helping you pinpoint where a coding error occurs, but can help you better understand how the code is organized and how execution passes from procedure to procedure.


This chapter largely ignores the errors caused by poor design — misrepresentation of data caused by ill-designed queries, update and insert anomalies caused by inappropriate application of referential integrity rules, and so on. For ...

Get Access 2013 Bible now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.