The ADO Error Object and Errors Collection

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

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.

Note   If there is no valid Connection object, the VBA Err object is the only source for information about ADO errors. Some ADO methods can also generate warnings that are returned as members of the Errors collection but will not affect a program's execution.

For more information about the ADO Error object and Errors collection, search the ADO Help index for "Error object" and "Errors collection."

See Also

Writing Error-Free Code | Design-Time Tools | Run-Time Tools | Script Debugging Tools | Basic Error Handling | Automating Error Handling | The VBA Err Object | Returning Information About an Error | Error Handling in Class Modules | Handling Script Errors