Share this Page URL

Chapter 5. Using Visual Basic to Automat... > Handling Errors and Debugging Code - Pg. 170

Using Visual Basic to Automate Your Database 170 Visual Basic adds general error-handling code to an event procedure by default when you've used a control wizard to add a control to a form. We also saw an example of error-handling code earlier in this chapter when we converted the ImportExpenses macro to Visual Basic. To learn more about the error-handling code that Visual Basic provides and how you can modify it to fit a database you're building, follow these steps. Add error-handling code 1. 2. 3. Open the HelloWorld5 database if it isn't already open. (The file is located in the Chap05 folder at the location where you copied the sample files for this book.) In the Database window, click Forms, select the form named Demonstrations, and then click Design. Right-click the Print Report button, and then click Build Event. You'll see the code for this button's Click event, shown here: