xxiv
Contents
Reducing Multiuser Errors with Unbound Forms..............................................................780
Creating an unbound form ......................................................................................781
Making an unbound form work ..............................................................................781
Summary ..........................................................................................................................788
Chapter 22: Integrating Access with Other Applications . . . . . . . . . . . . 789
Using Automation in Access ..............................................................................................790
Understanding how Automation works ...................................................................790
Creating Automation references ..............................................................................791
Binding your VBA object variables to objects in the Automation interface ...............792
Creating an instance of an Automation object .........................................................795
Getting an existing object instance ..........................................................................797
Working with Automation objects ..........................................................................799
Closing an instance of an Automation object ...........................................................800
Looking at an Automation Example Using Word ..............................................................800
Creating an instance of a Word object .....................................................................805
Making the instance of Word visible .......................................................................805
Creating a new document based on an existing template .........................................806
Inserting data ..........................................................................................................806
Activating the instance of Word ..............................................................................806
Moving the cursor in Word .....................................................................................807
Discarding the Word object instance .......................................................................807
Inserting pictures by using bookmarks ....................................................................807
Using Office’s macro recorder .................................................................................808
Collecting Data with Microsoft Outlook ............................................................................811
Creating an e-mail ...................................................................................................811
Managing replies .....................................................................................................815
Summary ..........................................................................................................................818
Chapter 23: Handling Errors and Exceptions . . . . . . . . . . . . . . . . . . . . . . 819
Dealing with Errors ...........................................................................................................820
Logical errors ..........................................................................................................820
Runtime errors ........................................................................................................821
Identifying Which Errors Can Be Detected ........................................................................824
What an error handler is .........................................................................................824
How to set a basic error trap ...................................................................................825
Trapping Errors with VBA .................................................................................................826
The Err object .........................................................................................................827
VBA error-handling statements ................................................................................829
The Error event .......................................................................................................836
The ADO Errors collection ......................................................................................837
Summary ..........................................................................................................................838
02_475348-ftoc.indd xxiv02_475348-ftoc.indd xxiv 4/1/10 1:42 PM4/1/10 1:42 PM