48Highlander
Technical User
I have had to go through hoops to get Access properly linked with an HTML help file. I now have all of the forms working properly when the user presses F1 to get help. However, when the user wants to get the help topic for the report, my code doesn't work.
The following code came from MS KB271390 and it is run when an autokey macro for {F1} is run.
How do I change it to detect that the active object is a report, not a form, and then retrieve the HelpContextID of the report?
Bill J
The following code came from MS KB271390 and it is run when an autokey macro for {F1} is run.
How do I change it to detect that the active object is a report, not a form, and then retrieve the HelpContextID of the report?
Code:
Public Function HelpEntry()
'Identify the name of the Help file and a possible context-id.
Dim FormHelpId As Long
Dim curForm As Form
Dim CurrentPath As String
CurrentPath = CurrPath()
strHelpFile = CurrentPath & "MrHelpFile.chm"
'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.
FormHelpId = 10
'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 <> "" Then
strHelpFile = 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(curForm.ActiveControl.Properties("HelpcontextId")) Then
If curForm.ActiveControl.Properties("HelpcontextId") > 0 Then
FormHelpId = curForm.ActiveControl.Properties("HelpcontextId")
Else
FormHelpId = curForm.HelpContextID
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 strHelpFile, FormHelpId
End Function
Bill J