>

HelpContext, HelpFile Properties

Applies To

Error Object.

Remarks

If a Microsoft Windows Help file is specified in HelpFile, the HelpContext property is used to automatically display the Help topic it identifies.

Note

You should write routines in your application to handle typical errors. When programming with an object, you can use the Help supplied by the object's Help file to improve the quality of your error handling, or to display a meaningful message to your user if the error is not recoverable.

See Also

Description Property, Number Property, Source Property.

Specifics (Microsoft Access)

The data access HelpContext and HelpFile properties apply to the Error object. You can set it only from Visual Basic.

Note

Don't confuse these properties with the Microsoft Access HelpContextID and HelpFile properties. These properties are similar, but they apply only to forms, reports, and controls. You can set them from Visual Basic, in a macro, or in the property sheet within form Design view or report Design view.

Example

This example uses the HelpContext and HelpFile properties of an Error object to start the Microsoft Windows Help system. By default, the HelpFile property contains the name of the Microsoft Jet database engine error message Help file.

 

On Error Resume Next    ' Suppress errors for demonstration purposes.
Err.Raise 3005    ' Use VBA to generate "Invalid database name" error.
Msg = "Press F1 or Help to see " & Errors(0).HelpFile & _
    " topic for this error"
MsgBox Msg, , "Error: " & Errors(0).Description & _
    Errors(0).HelpFile & Errors(0).HelpContext