Chapter 23. Handling Errors and Exceptions

IN THIS CHAPTER

  • Addressing logical and runtime errors

  • Identifying which errors to trap

  • Using VBA code to trap errors

Access database applications prepared by even the very best developers have problems. By their very nature — when you consider table and query design, forms and reports, and implementation details — database applications are complicated. Plus, the VBA code written for databases often results in coding errors. If you're lucky, the problem and its cause are obvious and easy to fix. If you're not so lucky, you know there's a problem, but its source isn't immediately apparent. In the worst-case scenario, programming bugs are silently and perniciously damaging data — or the representation of data in an application — without any warning.

This chapter looks at the types of errors you'll encounter in Access applications and tells you the steps you can take to uncover and repair these critters.

Note

This chapter largely ignores the errors caused by poor design — those that misrepresent data because of ill-designed queries, update and insert anomalies caused by inappropriate use of referential integrity rules, and so on. For the most part, the causes of design errors are rooted in failure to conform to database development best practices, misunderstanding Access query design, and other causes. You have to pay careful attention to database design principles in order to produce truly robust Access applications.

Note

There is no database for this ...

Get Access® 2010 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.