Microsoft KB Archive/275117

= Custom Help file is displayed in Access Help window =

Article ID: 275117

Article Last Modified on 7/25/2007

-

APPLIES TO


 * Microsoft Office XP Developer Edition
 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q275117



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

For a Microsoft Office 2000 Developer version of this article, see 271390.



SYMPTOMS
In Microsoft Access, when you display a custom Compressed HTML (.chm) Help file, the Help content is displayed in the Access Help window, along with the default Access index, the Access Answer Wizard, and the Access title. This behavior occurs even if you specify your own title and index within the Help file.



RESOLUTION
To work around this issue, create a macro to run the Compressed HTML Help file in its own window. To do this, follow these steps:  See the following article in the Microsoft Knowledge Base:

296231 How to create context-sensitive HTML Help files in Office XP Developer

Then, follow the instructions in the article to create the sample Help file and database. In the same database in which you created the form, click Modules in the Database window, and then click New.  Type or paste the following code in the new module: Option Compare Database Option Explicit

Declare Function HtmlHelp Lib &quot;hhctrl.ocx&quot; Alias &quot;HtmlHelpA&quot; _ (ByVal hwndCaller As Long, ByVal pszFile As String, _        ByVal uCommand As Long, ByVal dwData As Long) As Long

Const HH_DISPLAY_TOPIC = &H0 Const HH_SET_WIN_TYPE = &H4 Const HH_GET_WIN_TYPE = &H5 Const HH_GET_WIN_HANDLE = &H6 Const HH_DISPLAY_TEXT_POPUP = &HE Const HH_HELP_CONTEXT = &HF Const HH_TP_HELP_CONTEXTMENU = &H10 Const HH_TP_HELP_WM_HELP = &H11

Public 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 Select End Sub

Public 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 = &quot;C:\MyProject.chm&quot; 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 <> &quot;&quot; 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(Screen.ActiveControl.Properties(&quot;HelpcontextId&quot;)) Then If Screen.ActiveControl.Properties(&quot;HelpcontextId&quot;) > 0 Then FormHelpId = Screen.ActiveControl.Properties(&quot;HelpcontextId&quot;) 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, FormHelpId End Function  Save the module as Module1, and then quit the Visual Basic Editor. In the Database window, click Macros, and then click New. On the View menu, click Macro Names.</li> Type the following in the first line in the Macro Name column:

{F1}

</li> Set the Action field for {F1} to RunCode.</li> For the Function Name argument, type the following:

=HelpEntry

</li> Save your new macro as AutoKeys and close it.</li> In the Database window, click Forms, and then open Form1 in Form view.</li> Click the second field, and then press F1. Note that the custom Help file is displayed in its own window.</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to reproduce the problem
<ol> See the following article in the Microsoft Knowledge Base:

296231 How to create context-sensitive HTML Help files in Office XP Developer

Follow the instructions in the article to create the sample database and the custom Help file.</li> Open Form1 in Form view.</li> Click the second field, and then press F1. Note that the sample Help topic for the second text box is unexpectedly displayed in the Access Help window with the Access title, index, and Answer Wizard.</li></ol>

Additional query words: pra

Keywords: kbbug kbnofix kbpdwizard KB275117

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.