Article ID: 124823
Article Last Modified on 6/13/2001
Declare Function WinHelp% Lib "User" (ByVal hwnd%, ByVal _ szHelpFile$, ByVal uCmd%, ByVal dwData&) Declare Function FindWindow% Lib "User" (ByVal szClass$, ByVal _ szTitle As Any)NOTE: You may have some Microsoft Windows API functions defined in an existing Microsoft Access library; therefore, your declarations may be duplicates. If you receive a duplicate procedure name error message, remove or comment out the declarations statement in your code.
Const HELP_CONTEXTPOPUP = 8
Function Help ()
Dim Cid As Integer, Dummy As Integer
On Error Resume Next
' Get the HelpContextID of the active control.
Cid = Screen.ActiveControl.HelpContextID
' The error is 2474 if no control is active.
If Cid = 0 Then
' There is no control context ID, so check the form and get
' the HelpContextID of the active form.
Cid = Screen.ActiveForm.HelpContextID
' The error is 2475 if no form is active.
End If
' If there is a context ID, open the Help file with context.
' FindWindow() returns the handle of the Microsoft Access window.
' Specify your custom Help file for the second argument.
If Cid > 0 And Cid < 32767 Then
Dummy = WinHelp(FindWindow("OMain", 0&), "C:\Myhelp.Hlp", _
HELP_CONTEXTPOPUP, Cid)
End If
End Function
Macro Name Condition Action
--------------------------------
{F1} RunCode
AutoKeys Action
------------------------
RunCode
Function Name: Help()
Additional query words: pop up popup
Keywords: kbhowto kbprogramming KB124823