Microsoft Office 2000/Visual Basic Programmer's Guide   

Displaying Context-Sensitive Help in Access Forms

Implementing context-sensitive Help for interface elements in Access forms is similar to the process of defining context-sensitive Help for UserForms, except the form and control properties you set are slightly different. In addition, you can specify different Help files for each form, and specify the window type in which to display the topic. To display the topic in a full WinHelp 4.0 Help window, enter the context ID as a positive value; that is, enter it exactly as it is defined in your .hlp file. To display the topic in a small borderless pop-up window that appears adjacent to the interface element, precede the context ID with a minus sign ( – ). Note that this does not mean you need to use negative values for context IDs when authoring your .hlp file; you need only precede the authored value with a minus sign.

To define context-sensitive Help for Access forms

  1. Create a WinHelp 4.0 Help file that contains the Help topics you want to display. For more information about creating a Help file, see "Creating a Help File to Use with an Office Solution" earlier in this chapter.

  2. Open the form you want to work with in Design view and display the form's property sheet. To do this, click Select Form on the Edit menu, and then click Properties on the View menu.

  3. Click the Other tab, and then set the HelpFile property to the full path and name of the Help file that contains context-sensitive Help topics.

    If you don't want to include the full path to the Help file, omit steps 2 and 3 and add code to the form's Load event that specifies the path by using the form's HelpFile property and the CurrentProject object's Path property. For example:

    Dim strHelpPath As String
    
    strHelpPath = CurrentProject.Path & "\samplepopups.hlp"
    
    Me.HelpFile = strHelpPath
    
  4. In the form's property sheet, click the Format tab, set the MinMaxButtons property to None, and set the WhatsThisButton property to Yes.

  5. For each control that you want to display context-sensitive Help for, set the control's HelpContextID property to the context ID of the topic you want to display for that control. To display the topic in a borderless pop-up window, precede the context ID with a minus sign ( – ).