ADO Errors Collection

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO Errors Collection

The Errors Collection contains all of the Error objects that were created as the result of a single failure involving the provider. Each time a failure occurs involving the provider, the Errors Collection is cleared and the new Error objects that have been created are inserted into the collection.

Only the Connection object has an Errors Collection. The collection is numbered (indexed) starting at zero.
 
Each Error object contains a specific provider (not an ADO) error or warning. ADO errors are handled differently. When an ADO error occurs, it generates a run-time exception-handling mechanism.
 
While provider warnings usually do not halt normal program execution, these warnings will have to be dealt with under certain circumstances. It is recommended that you apply the Clear method to the Errors Collection before you call any of the following:  
 

Object Method or Property
Connection Open method
Recordset CancelBatch method
Recordset Filter property
Recordset Resync method
Recordset UpdateBatch method

 
The Errors Collection has access to two properties and two methods.

Properties
Count
The Count property returns a long value that is the number of items in the collection. The counting starts at zero. You can use this value to loop through the collection by iterating from zero to the value of Count minus one.

Item
The Item property is used to return a specific member of the Errors Collection.

Methods
Clear
The Clear method is automatically called each time a provider failure occurs to remove all previous Error objects that may exist in the Errors Collection before setting the new error information.

Refresh
The Refresh method updates the Property objects in the Properties Collection with the dynamic property information specific to the provider. It is quite possible that the provider has dynamic properties that are not supported by ADO.