Link to home
Start Free TrialLog in
Avatar of merdeka
merdekaFlag for Canada

asked on

Invoke chm help in access 2007

I have created chm help for an access 2007 application and entered the path and help context ID's to the mdb but in Access 2007 the What's This button seems to have been discontinued.

How do I invoke the chm help file in my access program.
Avatar of rockiroads
rockiroads
Flag of United States of America image

Ive used .hlp (winhelp) files before not chm and all I had to do was hit F1 on the appropriate place (where context id specified)
Dunno if that is still the case with CHMs?

Avatar of merdeka

ASKER

Rockiroads,

Apparently it is not with chm files as I have tried that.  My chm help file is in C:\Program Files\MyAppHelp\
and I have opened the file using the path from the Help File property in the Access form so I know the path is good.  

In Access 2003 there used to be a form property called "What's This" that would open the chm help file when the What's This question mark icon was clicked and the field that help was wanted for was clicked.  Now the What's This feature seems to be gone from Access 2007 so I need to know how to call my chm help.

Thanks,
merdeka
ok, gotcha.
Well Im not sure but ms got this site which is supposed to explain where a A2003 item is now in A2007. Ive not gone through it myself but it may help
http://office.microsoft.com/en-us/access/HA102388991033.aspx
Avatar of merdeka

ASKER

rockiroads,

I don't see it there.  Maybe its me but my experience with Microsoft help for Access is frustration 95% of the time.

Thanks,
merdeka
yea its crap eh, i clicked the start the guide link and I couldnt go past the first screenshot. Status bar still says waiting for ... and its been 10mins

did u check out the download also? http://office.microsoft.com/en-us/templates/TC102128601033.aspx

I will try search ms to see where it is, otherwise I dont really know
Avatar of merdeka

ASKER

rockiroads,

I checked the link you provided above but the answer doesn't seem to be there either.  Maybe Microsoft has found that (their) help files are useless so we don't need them anymore.

Thanks,
merdeka
lol, that sounds right.
I havent found anything yet, will look again tomorrow
Avatar of merdeka

ASKER

rockiroads,

The F1 key won't open MS Access help or my custom help file in design view (i.e. my program form active) - is this normal?.  When I click F1 the mouse pointer momentarily changes to an hourglass then back to a pointer.  The f1 key works in design view and in the code window.

Thanks,
merdeka
My understanding was that if you specify the help file in a form, F1 would be looking for that using the context id's to find the right page but only during runtime.
when I did winhelp pages longtime back (now redundant), this is what I did, set the help file then that help file had id's set. The form would then use one of them id's.
Ive no idea about chm's though. There might be a similar thing
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of merdeka

ASKER

rockiroads,

I have added help to a number of Access 2003 programs and it was nothing like what is described in the link above.  

In Access 2003 I just added the chm help file contextID in the Other > Help contedt ID field of the form property sheet or the object property sheet and added the path to the chm help file in Help file property of the form and it worked fine.  The difference I can see between Access 2007 and Access 2003 is that Access 2003 had a propery called 'What's this?' which put a question mark in the title bar of the form which you could click and then click on the object in question and the chm help file would open.  

merdeka
Avatar of merdeka

ASKER

rockiroads,

I tried the code from the link above and the macro from the link above (RoryJakes code and ptPaton modification) but it still doesn't work (please see attached code snippet).  I don't have a contextID of 1001 but I tried it with contextID 1001 and contextID 100 in the code, I do have contextID 100 in my CHM file, but nothing happens when I click the F1 key.

BostonFrog (same article) mentions something about ALIAS and MAP which I don't understand.

Thanks,
merdeka


Option Compare Database
Option Explicit
 
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 Sub Show_Help(HelpFileName As String, MycontextID As Long)
    'A specific topic identified by the variable context-ID is started in
    'response to this button click.
    Dim hwndHelp As Long
 
    'The return value is the window handle of the created Help window.
    Select Case MycontextID
        Case Is = 0
            hwndHelp = HtmlHelp(Application.hWndAccessApp, HelpFileName, _
                       HH_DISPLAY_TOPIC, MycontextID)
        Case Else
            hwndHelp = HtmlHelp(Application.hWndAccessApp, HelpFileName, _
                       HH_HELP_CONTEXT, MycontextID)
    End Select
End Sub
 
Public Function HelpEntry()
    'Identify the name of the Help file and a possible context-id.
    Dim FormHelpId As Long
    Dim FormHelpFile As String
    Dim curForm As Form
Dim lnghWnd As Long, strHelpFile As String, lngContext As Long
Dim lngRetVal As Long, obj As Object
 
On Error Resume Next
Const conHelpContext = &H1
Set obj = Screen.ActiveForm
 
If Err = 2475 Then
Err = 0
Set obj = Screen.ActiveReport
If Err = 2476 Then
Err = 0
 
End If
End If
 
With obj
lnghWnd = .Hwnd
strHelpFile = .HelpFile
lngContext = .HelpContextId
End With
 
    '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.
    FormHelpFile = "C:\Program files\MyTimesheet\CoreTimesheetHelp.chm"
    FormHelpId = 1001
 
    '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
        FormHelpFile = curForm.HelpFile
    End If
    
    If curForm.HelpContextId <> 0 Then
        FormHelpId = curForm.HelpContextId
    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")
        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 FormHelpFile, FormHelpId
End Function

Open in new window

Avatar of merdeka

ASKER

I think the solution might work but it didn't work for me.