OLEDBError Object (Excel)
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

OLEDBError Object (Excel)

Office 2010

Represents an OLE DB error returned by the most recent OLE DB query.

The OLEDBError object is a member of the OLEDBErrors collection. If the specified OLE DB query runs without error, the OLEDBErrors collection is empty. The errors in the collection are indexed in the order in which they're generated by the OLE DB provider.

Use OLEDBErrors(index), where index is the index number of the OLE DB error, to return a single OLEDBError object. The following example displays the error description and the SqlState property’s value for the first error returned by the most recent OLE DB query.

Set objEr = Application.OLEDBErrors(1) 
MsgBox "The following error occurred:" & _ 
 objEr.ErrorString & " : " & objEr.SqlState
© 2015 Microsoft