Class Errors (ADODB VBA)

Contains all the Error objects created in response to a single provider-related failure provider. To use a Errors class variable it first needs to be instantiated, for example

Clear

Removes all the Error objects from the Errors collection.

Use the Clear method on the Errors collection to remove all existing Error objects from the collection. When an error occurs, ADO automatically clears the Errors collection and fills it with Error objects based on the new error. 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 Resync, UpdateBatch, or CancelBatch methods on a Recordset object; the Open method on a Connection object; or set the Filter property on a Recordset object, call the Clear method on the Errors collection. That way, you can read the Count property of the Errors collection to test for returned warnings.

Count

Indicates the number of objects in a collection.

Use the Count property to determine how many objects are in a given collection. Because numbering for members of a collection begins with zero, you should always code loops starting with the zero member and ending with the value of the Count property minus 1. If you are using Microsoft Visual Basic and want to loop through the members of a collection without checking the Count property, use the For Each...Next command. If the Count property is zero, there are no objects in the collection.

Item

Indicates a specific member of a collection, by name or ordinal number.

Use the Item property to return a specific object in a collection. If Item cannot find an object in the collection corresponding to the Index argument, an error occurs. Also, some collections don't support named objects; for these collections, you must use ordinal number references. The Item property is the default property for all collections; therefore, the following syntax forms are interchangeable:

Item (Index)

Index: A Variant expression that evaluates either to the name or to the ordinal number of an object in a collection.

Refresh

Updates the objects in a collection to reflect objects available from, and specific to, the provider.

The Refresh method accomplishes different tasks depending on the collection from which you call it.