ADO Error Object

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

ADO Error Object

The ADO Error object contains details about data access errors that have been generated during a single operation. 

ADO generates one Error object for each error. Each Error object contains details of the specific error, and are stored in the Errors collection. To access the errors, you must refer to a specific connection.

Syntax

objErr.property

Properties

Property

Description

Description Returns an error description
HelpContext Returns the context ID of a topic in the Microsoft Windows help system
HelpFile Returns the full path of the help file in the Microsoft Windows help system
NativeError Returns an error code from the provider or the data source
Number Returns a unique number that identifies the error
Source Returns the name of the object or application that generated the error
SQLState Returns a 5-character SQL error code

Example: to loop through the Errors collection

for each objErr in objConn.Errors
  debug.print("Description: ")
  debug.print objErr.Description & VbCrLf
  debug.print("Help context: ")
  debug.print objErr.HelpContext & VbCrLf
  debug.print("Help file: ")
  debug.print objErr.HelpFile & VbCrLf
  debug.print("Native error: ")
  debug.print objErr.NativeError & VbCrLf
  debug.print("Error number: ")
  debug.print objErr.Number & VbCrLf
  debug.print("Error source: ")
  debug.print objErr.Source & VbCrLf
  debug.print("SQL state: ")
  debug.print objErr.SQLState & VbCrLf
next