Microsoft Office 2000/Visual Basic Programmer's Guide |
Any operation involving ADO objects can generate one or more errors from the data provider. Each error resulting from an ADO operation creates an Error object that is added to the Connection object's Errors collection. If another ADO operation generates one or more errors, the Errors collection is cleared, and a new set of Error objects is placed in the Errors collection.
When an ADO error occurs, the VBA Err object contains the error number for the first object in the Errors collection. The values of the Number and Description properties of the first Error object in the Errors collection should match the values of the Number and Description properties of the VBA Err object.
Notes
To see a variety of examples that illustrate how to use the ADO Error object and Errors collection, use the F8 key to step through the code in the ADOErrorExample1 procedure, available in the modErrorCode module in ErrorHandlers.dot in the ODETools\V9\Samples\OPG\Samples\CH08 subfolder on the Office 2000 Developer CD-ROM.
For more information about the ADO Error object and Errors collection, search the ADO Help index for "Error object" and "Errors collection."