MOD2000: Custom Help File Displayed in Access Help Window

This article was previously published under Q271390
This article has been archived. It is offered "as is" and will no longer be updated.
Symptoms
In a Microsoft Access form that is associated with a custom Compressed HTML Help file (.chm), you notice that even though the Help file may display the appropriate topic, it is displayed in an Access Help window with the default Access index, Access Answer Wizard, and Access title. You find this behavior occurs even if you specify within the custom Help file's .hhp file a custom title and index. However, if you double-click the Compressed HTML Help file (.chm) from within Windows Explorer, the custom Help file appears in its own window, as expected.

NOTE: This behavior does not occur with non-HTML help files (*.hlp).
Resolution
You can write Visual Basic for Applications code to run the Compressed HTML Help file in its own window, as demonstrated in the following steps.

NOTE: This example displays the Help file in its own window only when you press F1.
  1. See the following article in the Microsoft Knowledge Base
    242433 MOD2000: How to Create Context Sensitive HTML Help Files
    and then follow the instructions in the article to create the sample Help file and database.
  2. In the same database in which you created the form, click Modules in the Database window, and then click New.
  3. Type or paste the following code in the new module:
    Option Compare DatabaseOption ExplicitDeclare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" _        (ByVal hwndCaller As Long, ByVal pszFile As String, _         ByVal uCommand As Long, ByVal dwData As Long) As LongConst HH_DISPLAY_TOPIC = &H0Const HH_SET_WIN_TYPE = &H4Const HH_GET_WIN_TYPE = &H5Const HH_GET_WIN_HANDLE = &H6Const HH_DISPLAY_TEXT_POPUP = &HEConst HH_HELP_CONTEXT = &HFConst HH_TP_HELP_CONTEXTMENU = &H10Const HH_TP_HELP_WM_HELP = &H11Public Sub Show_Help(HelpFileName As String, MycontextID As Long)    'A specific topic identified by the variable context-ID is started in    'response to this button click.    Dim hwndHelp As Long    'The return value is the window handle of the created Help window.    Select Case MycontextID        Case Is = 0            hwndHelp = HtmlHelp(Application.hWndAccessApp, HelpFileName, _                       HH_DISPLAY_TOPIC, MycontextID)        Case Else            hwndHelp = HtmlHelp(Application.hWndAccessApp, HelpFileName, _                       HH_HELP_CONTEXT, MycontextID)    End SelectEnd SubPublic Function HelpEntry()    'Identify the name of the Help file and a possible context-id.    Dim FormHelpId As Long    Dim FormHelpFile As String    Dim curForm As Form    'Set the curForm variable to the currently active form.    Set curForm = Screen.ActiveForm    'As a default, specify a generic Help file and context-id. Note that    'the location of your file may be different.    FormHelpFile = "C:\MyProject.chm"    FormHelpId = 1001    'Check the Help file property of the form. If a Help file exists,    'assign the name and context-id to the respective variables.    If curForm.HelpFile <> "" Then        FormHelpFile = curForm.HelpFile    End If    'If the Help context-id of the control is not null and greater than    'zero, assign the value to the variable.    If Not IsNull(curForm.ActiveControl.Properties("HelpcontextId")) Then        If curForm.ActiveControl.Properties("HelpcontextId") > 0 Then            FormHelpId = curForm.ActiveControl.Properties("HelpcontextId")        End If    End If    'Call the function to start the Help file, passing it the name of the    'Help file and context-id.    Show_Help FormHelpFile, FormHelpIdEnd Function					
  4. Save the module, and then close the Visual Basic Editor.
  5. In the Database window, click Macros, and then click New.
  6. Save the new macro with the name AutoKeys.
  7. On the View menu, click Macro Names.
  8. Type the following in the first line under Macro Name: {F1}.
  9. Set the action for {F1} to RunCode.
  10. For the Function Name argument, type the following:
    =HelpEntry()
  11. Save and then close the macro.
  12. Open the Form1 form in Form view.
  13. Click in the second field, and then press F1.
Note that the Help file is displayed in its own window.
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
More information

Steps to Reproduce the Behavior

  1. See the following article in the Microsoft Knowledge Base
    242433 MOD2000: How to Create Context Sensitive HTML Help Files
    and then follow the instructions in the article to create the sample Help file and database.
  2. Open the Form1 form in Form View.
  3. Click in the second field, and then press F1.
Note that even though the sample Help topic for the control appears, it is in the Microsoft Access Help window with the Access Answer Wizard and an Access title.
pra
Properties

Article ID: 271390 - Last Review: 10/26/2013 06:12:00 - Revision: 2.0

  • Microsoft Office 2000 Developer Edition
  • kbnosurvey kbarchive kbbug kbnofix kbpdwizard KB271390
Feedback