When programmers use the term "error handling," they really mean graceful or planned error handling. After all, Access takes some kind of action for any error that it encounters in your code. Graceful error handling includes the following:
Quietly absorbing expected errors so the user never sees them.
Displaying a "friendly" message to the user for unexpected errors, and closing the procedure properly.
Error handling in Access VBA involves adding code to every procedure—both subroutines (also known as subs) and functions—to take specific actions when Access encounters an error. This is called handling or trapping the error. (Some developers call the encounter with an error throwing an error. Error handling is the code that catches the error and handles it properly, either by hiding it from the users or by explaining it to them.)
This chapter provides techniques to handle several types of expected and unexpected errors so that your applications look and feel more professional to your users. But first, you'll explore why you should use error handling at all. Many Access developers see it as a mundane chore, but there are good reasons for including error handling in every procedure you write.