共用方式為


Err Object Members 

The Err object contains properties whose values are determined by the error that just occurred. The Number property contains the cause of the error, and the Description property contains a text message that describes the error in detail. Helpfile and HelpContext allow you to display a related help file when a user presses the Help button or the F1 key. LastDLLError displays the last DLL called and whether or not the call was successful. Source specifies a string expression representing the object or application that generated the error.

Properties

Description Property

Read/write. Returns or sets a descriptive string associated with an error.

Erl Property

Read-only. Returns an integer indicating the line number of the last executed statement.

HelpContext Property

Read/write. Returns or sets an Integer containing the context ID for a topic in a Help file.

HelpFile Property

Read/write. Returns or sets a String expression containing the fully qualified path to a Help file.

LastDLLError Property

Read-only. Returns a system error code produced by a call to a dynamic-link library (DLL).

Number Property

Read/write. Returns or sets a numeric value specifying an error.

Source Property

Read/write. Returns or sets a String expression specifying the name of the object or application that originally generated the error.

Methods

Clear Method

Clears all property settings of the Err object.

Raise Method

Generates a run-time error; can be used instead of the Error statement.

See Also

Tasks

How to: Retrieve Information from an Error Object

Reference

Err Object (Visual Basic)