>

Description Property

Applies To

Error Object.

Description

Returns a descriptive string associated with an error.

Remarks

The Description property comprises a short description of the error. Display this property to alert the user to an error that you cannot or do not want to handle.

See Also

HelpContext, HelpFile Properties; Number Property; Source Property.

Specifics (Microsoft Access)

The data access Description property applies to the Error object and returns a string associated with an error. You can set it only from Visual Basic.

Note

Don't confuse this property with the Microsoft Access Description property, which describes a table or query and its fields. This property applies to a TableDef object, a QueryDef object, or a Field object in the Fields collection of a TableDef or QueryDef object.

Example

This example forces an error, traps it, and displays the Description, Number, and Source properties of the resulting Error object.


Sub ForceError()
    Dim dbsTest As Database
    On Error GoTo TestErrorHandler
    Set dbsTest = OpenDatabase("DoesNotExist")
    Exit Sub

TestErrorHandler:
    Dim strError As String
    Dim errObj As Error
    strError = " "
    For Each errObj in DBEngine.Errors
        strError = strError & Format$(errObj.Number)
        strError = strError & " : " & errObj.Description
        strError = strError & " (" & errObj.Source & ") . "
        strError = strError & Chr$(13) & Chr$(10)
    Next
    MsgBox strError
    Resume Next
End Sub