This question involved MS Access 2010 and Windows 7 Professional.
I have a .chm file located on at C:/Windows/Help and it is opened in access using the following code:
I have a .chm file located on at C:/Windows/Help and it is opened in access using the following code:
Code:
Declare 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
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 Function HelpEntry()
Dim FormHelpId As Long
Dim FormHelpFile As String
Dim curForm As Form
Set curForm = Screen.ActiveForm
FormHelpFile = "C:\Windows\Help\NLDBHelpFile.chm"
FormHelpId = 1001
curForm.HelpFile = FormHelpFile
If Not IsNull(Screen.ActiveControl.Properties("HelpcontextId")) Then
If Screen.ActiveControl.Properties("HelpcontextId") > 0 Then
FormHelpId = Screen.ActiveControl.Properties("HelpcontextId")
End If
End If
Show_Help FormHelpFile, FormHelpId
End Function
Public Sub Show_Help(HelpFileName As String, MycontextID As Long)
Dim hwndHelp As Long
Select Case MycontextID
Case Is = 0
hwndHelp = HtmlHelp(0, HelpFileName, _
HH_DISPLAY_TOPIC, MycontextID)
Case Else
hwndHelp = HtmlHelp(0, HelpFileName, _
HH_HELP_CONTEXT, MycontextID)
End Select
End Sub
[CODE]
This works fine on my PC, but when I try it on another PC, nothing happens. The code is running correctly, but when it gets to this part, the screen just flashes once and nothing opens:
hwndHelp = HtmlHelp(0, HelpFileName, _
HH_HELP_CONTEXT, MycontextID)
I feel there is something on this other PC that is preventing it from opening the file. If I open the file directly, it works, and if I change the location of the file and use the same code above, nothing happens, leading me to believe something is preventing the PC from recognizing the hwndHelp part. Unfortunately, I am not computer savvy enough to troubleshoot this any farther. Any suggestions as to what might be going on? Thank you!
Last edited: