When I tried this Access help displayed and not the .chm. I probably need to add some vba code. Thanks
Oh sorry. Each form needs a Private Sub with the following in it:
Dim hwndHelp As Long
hwndHelp = HtmlHelp(hwnd, "NAMEOFHELPFILE.chm", HH_HELP_CONTEXT, 0)
I don't think the name of the Sub makes any difference. So, for example, if your help .chm file is named DBHelp.chm:
Each form has a sub:
Private Sub DBHelp_Click()
Dim hwndHelp As Long
hwndHelp = HtmlHelp(hwnd, "DBHelp.chm", HH_HELP_CONTEXT, 0)
Exit Sub
End Sub
You will also need a module with the following declarations and HtmlHelp Public Declare Function. PtrSafe allows the Public Declare Function to run under 64-bit ACCESS versions.
Option Compare Database
Public Const HH_DISPLAY_TOPIC = &H0
Public Const HH_SET_WIN_TYPE = &H4
Public Const HH_GET_WIN_TYPE = &H5
Public Const HH_GET_WIN_HANDLE = &H6
Public Const HH_DISPLAY_TEXT_POPUP = &HE
Public Const HH_HELP_CONTEXT = &HF
Public Const HH_TP_HELP_CONTEXT = &H10
Public Const HH_TP_HELP_CONTEXTMENU = &H10
Public Const HH_TP_HELP_WM_HELP = &H11
Public Const WM_CLOSE = &H10
Public Declare PtrSafe Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal hwndCaller As Long, ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Long) As Long