The Errors collection contains all stored Error objects, all of which pertain to a single operation involving ADO.
Any operation involving ADO objects can generate one or more errors. As each error occurs, one or more Error objects may be placed in the Errors collection of the Connection object. When another ADO operation generates an error, the Errors collection is cleared, and the new set of Error objects may be placed in the Errors collection. ADO operations that don't generate an error have no effect on the Errors collection. Use the Clear method to manually clear the Errors collection.
The set of Error objects in the Errors collection describes one error. Enumerating the specific errors in the Errors collection enables your error-handling routines to more precisely determine the cause and origin of an error, and take appropriate steps to recover.
Some properties and methods return warnings that appear as Error objects in the Errors collection but do not halt a program's execution. Before you call the Delete, Resync, UpdateBatch, or CancelBatch methods on a Recordset object, or before you set the Filter property on a Recordset object, call the Clear method on the Errors collection so that you can read the Count property of the Errors collection to test for returned warnings.
To refer to an Error object in a collection by its ordinal number, use either of the following syntax forms:
connection.Errors.Item(0)
connection.Errors(0)
Note See the Error object topic for a more detailed explanation of the way a single ADO operation can generate multiple errors.