Chapter 25. Handling Errors and Exceptions
IN THIS CHAPTER
Dealing with errors
How Access deals with errors
Trapping errors with VBA code
The Error event
The Errors collection
The Err object
The VBA On Error and Resume statements
Access database applications prepared by even the very best developers have problems. By their very nature, database applications tend to be fairly complicated when you consider table and query design, forms and reports, and implementation details. All the VBA code that needs to be written for most databases can inevitably result in coding errors. If you're lucky the problem and its cause are obvious and are easy to fix. The situation becomes difficult when you know there's a problem, but its source is not immediately apparent. The worst situation for all concerned are those bugs that silently and perniciously damage data, or the representation of data in an application, and without any warning.
This chapter takes a look at the types of errors you'll encounter in Access applications, and some of the steps you can take to uncover and repair these little critters. This chapter largely ignores the errors caused by poor design: those of misrepresentation of data caused by ill-designed queries, update and insert anomalies caused by inappropriate application of referential integrity rules, and so on. For the most part the causes of poor design errors are rooted in failure to conform to proper design disciplines, misunderstanding Access query design, among ...