Set Help file and HelpcontextId in MS Access

In many development platforms the way to achieve F1 content sensitive help is by connecting the applications forms / reports / dialogs / controls to topic pages using HelpFile and ContextId properties.

Tip
The Help Generator add-ins for Microsoft Access and VB6 automatically assigns Help File and ContextId to each form and this way connect to a corresponding generated topic page - which saves you a lot of time.
Example: Form Properties linking F1 to topic page in help file 

The image on the right shows the properties set in MS Access.

  • The Help File property tells F1 to open the Faculty.chm file
  • The Help Context Id is a numeric way to tell which page to open in the Help File

 

Which topic page does Help Context Id point to?

To make the connection, you have to inform the the help compiler about the existance using the .hhp file. For this, we find it convenient to use a Map file and an Alias file. You can create these  manually, but if you use the Help Generator add-in they will be created automatically.

HHP File

In the above example the HHP file contains sections for alsia and mapping:

[ALIAS]
#include Faculty_alias.txt
[MAP]
#include Faculty_map.txt

Map file

You can assign the Context ID numbers to the specific topics in a Map file. The Map file is actually a C header file that is used by the Help compiler when the Help compiler compresses all the *.htm files into one *.chm file. The Map file is a plain-text file that contains the #define statement for each topic in your Help system....

#define IDH_Faculty_Query_frm 50
#define IDH_Faculty_Address_Book_rpt 60
...

Yes, the numerics (50, 60,...) are the Help Context Ids from the property window.

Alias file

The Help topics (.html files) must be associated to the topic identifiers that are defined in the Map file. You can do this if you define aliases for the Help topics. An alias is the relationship between a window-level Help topic (.html file) and a topic identifier in a Map file.

...
IDH_Faculty_Query_frm=Faculty_Query_frm.htm
IDH_Faculty_Address_Book_rpt=Faculty_Address_Book_rpt.htm
...

Adding new Help Context Ids

You are free to add new Help Context Ids. Make sure you add an entry both in the map and the alias files.

Activating help from your application