Part III: More-Advanced Access Techniques
822
Other runtime errors may be less obvious and more difficult to deal with. For example, a network
glitch may cause data loss or make lookup data temporarily unavailable. Running out of swap disk
space makes Windows run erratically or crash. Many computers are equipped with marginal mem-
ory, making it difficult or impossible to run large queries or use the built-in Access wizards.
A good approach to avoiding runtime errors is to keep an Access database file well maintained by
periodically running a compact and repair cycle:
- Click the Office Button at the top-left of the Access window.
- Select the Compact and Repair This Database option from the menu, as shown in
Figure 23.1.
FIGURE 23.1
Compacting and repairing a database
Best practices dictate frequent maintenance of an Access .accdb file, particularly if data is often
deleted or modified. A compact and repair cycle helps to ensure physical integrity of the .accdb
file on the hard disk.
When the application handles the errors
Access, Visual Basic, and the other VBA applications, such as Word and Excel, can handle errors
for you. Unfortunately, the built-in error handling in most applications is not really intended for
end users. Figure 23.2 shows a typical runtime error message produced by Access. Notice how
unhelpful the message is — it includes technical expressions, such as type mismatch — and most
users have no idea how to respond to this type of error message. Unless appropriate training has
been provided, the user will likely guess at the correct action to take in response.