Using error trapping on all Visual Basic procedures
An error-handling routine gives you a chance to display a friendly message to the user, rather than
some unintuitive default message box; Figure 35-10 shows a message box with a runtime error
???2102,??? which is unintuitive; however, it also shows a more-detailed message of a form missing or
misspelled. The user will not know the name of the form or if it??™s misspelled or missing. An errorhandling
routine is needed to provide the user with a more informative and meaningful error message
than what is shown in Figure 35-10.
CROSS-REF
TIP
NOTE
1130
Professional Database Development Part IV
FIGURE 35-10
An error message resulting from a procedure with no error-handling routine
One of the most important elements of bulletproofing an application is making sure that the application
never crashes??”that is, never ceases operation completely and unexpectedly. Although
Access provides built-in error processing for most data-entry errors (for example, characters
entered into a currency field), automatic processing doesn??™t exist for VBA code errors.
Pages:
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124