Error Object |
Dim error As ADODB.Error The Error object contains information regarding a particular error or warning that was raised by a data provider during an ADO operation.

Error.Description Property | (Versions 2.0, 2.1, 2.5, 2.6)
description = error.Description
The Description property describes the error or warning either ADO or the data provider has generated.
Datatype
String
Description
The Description property of the Error object is read-only. It offers error or warning information in a String form so that you can notify the user of your application that an error or warning has occurred. The value of the Description property can come from either ADO or the provider.

Error.HelpContext Property/Error.HelpFile Property | (Versions 2.0, 2.1, 2.5, 2.6)
helpcontext = error.HelpContext helpfile = error.HelpFile
The HelpContext and HelpFile properties indicate the topic and the name, respectively, of a particular error within an Error object.
Datatype
Long (HelpContext Property) String (HelpFile Property)
Description
The HelpFile property contains a fully qualified path to a Windows Help file. The HelpContext property automatically displays a Help topic from the Windows Help file that is indicated through the HelpFile property. If no Help topic is relevant to the generated error, the HelpContext property returns zero, and the HelpFile property returns an empty string (").

Error.NativeError Property | (Versions 2.0, 2.1, 2.5, 2.6)
nativeerror = error.NativeError
The NativeError property returns the error code supplied by the data provider for the current Error Object.
Datatype
Long
Description
Use this property to retrieve error codes that pass from the data source to the data provider and then to ADO.

Error.Number Property | (Versions 2.0, 2.1, 2.5, 2.6)
number = error.Number
The Number property is used to uniquely identify the error specified by the current Error object.
Datatype
Long or ErrorValueEnum (Long)
Description
The value of the Number property is a unique number that describes an error that has occurred. The value can be one of the ErrorValueEnum enumeration values shown in Table E-18.
See Also
ErrorValueEnum Enumeration

Error.Source Property | (Versions 2.0, 2.1, 2.5, 2.6)
source = error.Source
The Source property returns the name of an object or application that generated an error within ADO.
Datatype
The Error object returns a String.
Description
For the Errors object, the Source property indicates the name of the object or application that originally generated an error within ADO. ADO errors will have a source value beginning with the value ADODB. followed by the name of the object that generated the error.

Error.SQLState Property | (Versions 2.0, 2.1, 2.5, 2.6)
sqlstate = error.SQLState
The SQLState property returns the SQL state of the current Error object.
Datatype
String (five characters)
Description
Use this property to retrieve the five-character error code that the data provider returns to ADO when an error occurs processing a SQL statement. These error codes should be ANSI SQL standard, but they may not be, depending on the particular data provider.

Errors Collection | (Versions 2.0, 2.1, 2.5, 2.6)
Set errors = connection.Errors
See the Error Object for more information and examples pertaining to the Errors collection.
Objects

Error

  Contains information regarding a particular error or warning that was raised by ADO during an operation.

Methods

Clear

  The Clear method erases all errors stored in the Errors collection.

Refresh

  The Refresh method of the Errors collection is an undocumented method of ADO that has been around since Version 2.0.

Properties

Count

  Indicates how many Error objects belong to the associated Errors collection.

Item

  Accesses a particular Error object belonging to the Errors collection.

Errors.Clear Method | (Versions 2.0, 2.1, 2.5, 2.6)
errors.Clear
The Clear method erases all errors stored in the Errors collection.
Description
The Clear method clears the current collection of ADO errors. When a new runtime error is generated, the Errors collection is automatically cleared and then populated with the error information. Use the Clear method when you are going to make calls to a Recordset object that might return multiple warnings. These calls include Delete, Resync, UpdateBatch, and CancelBatch. Once you have made any of these calls, after clearing the Errors collection, you can determine whether any warnings were generated by the call in question.
See Also
Recordset.CancelBatch Method, Recordset.Delete Method, Recordset.Resync Method, Recordset.UpdateBatch Method

Errors.Count Property | (Versions 2.0, 2.1, 2.5, 2.6)
count = errors.Count
The Count property indicates how many Error objects belong to the associated Errors collection.
Datatype
Long
Description
If the value of the Count property is zero, there are no Error objects within the associated Errors collection. However, Error objects that do belong to the associated Errors collection are indexed from 0 to one less than the value of the Count property.

Errors.Item Property | (Versions 2.0, 2.1, 2.5, 2.6)
Set error = errors.Item(Index) Set error = errors (Index)
The Item property accesses a particular Error object belonging to the Errors collection.
Datatype
Error object
Description
The Index placeholder represents a Variant datatype that represents the ordinal position of an Error object within the Errors collection. If the Errors collection does not contain the item requested, an error is generated.
Note
Some languages do not support the Item property in its first syntax. For these languages, use the second syntax, without the Item method name.

Errors.Refresh Method | (Versions 2.0, 2.1, 2.5, 2.6)
errors.Refresh
The Refresh method of the Errors collection is an undocumented method of ADO that has been around since Version 2.0.
Description
The Errors.Refresh method appears to requery for errors within ADO.