PRA: Help Context ID Property Does Not Work in SubformArticle ID: Q100157Creation Date: 16-JUN-1993 Revision Date: 19-SEP-1996
The information in this article applies to:
SYMPTOMS
If you press the F1 key to invoke the Help system when the insertion
point is in a subform control, Microsoft Access invokes the main form's
Help file Contents window, rather than invoking the appropriate Help
topic for the subform control.
CAUSE
Microsoft Access ignores the Help ContextID property of the subform
control.
RESOLUTION
As a workaround for this problem, you can follow the steps below to
create a custom Help function that will test to determine which control
is active on a form, and then call the Microsoft Windows Help() API
function to invoke the appropriate Help topic for that control:
'Declarations section of the module'*************************************************************
Option Explicit
Declare Function WinHelp% Lib "User" (ByVal hwnd%, ByVal lpHelpFile$,_
ByVal wCmd%, ByVal dwData As
Any)
Global Const HELP_CONTEXT = &H1
Global Const HELP_CONTENTS = &H3
'*************************************************************
' FUNCTION NAME: Help() ' ' PURPOSE: ' Based on the currently active control, the Windows Help() API ' function is called to invoke Help on a predefined ContextID for ' the control. If the ControlName is not represented, a ' message appears, indicating no Help topic is available. ' If there is no active form available, the contents of the ' Help file are invoked. ' ' INPUT PARAMETERS: ' HelpFile: Path and filename of Help file to use ' ' RETURN ' None'************************************************************* Function Help (HelpFile As String)
Dim ContextID As Long
Dim Ret As Integer
On Error GoTo HelpError
' Determine which control needs Help and set the
' .. appropriate ContextID for the control.
Select Case Screen.ActiveControl.ControlName
'NOTE: You must customize the Case statements that follow
' for your specific control names and the ContextID to call
' for the control name.
Case "Category ID"
ContextID = 1
Case "Category Name"
ContextID = 1
Case "Description"
ContextID = 1
Case "Product ID"
ContextID = 2
Case "Product Name"
ContextID = 2
Case "Unit Price"
ContextID = 2
Case "Picture"
ContextID = 2
Case Else
MsgBox "No help for " & Screen.ActiveControl.ControlName
ContextID = -1
End Select
' Call the Help file with the appropriate ContextID.
If ContextID > -1 Then
Ret = WinHelp(Screen.ActiveForm.hwnd, HelpFile, _
HELP_CONTEXT, ContextID)
End If
GoTo ByeHelp
HelpError:
' Display the Contents window of the Help file.
Ret = WinHelp(0, HelpFile, HELP_CONTENTS, 0&)
Resume ByeHelp
ByeHelp:
End Function
STATUS Microsoft has confirmed this to be a problem in Microsoft Access version 1.0. This problem no longer occurs in Microsoft Access version 1.1. |
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.