Microsoft Office 2000/Visual Basic Programmer's Guide   

Creating Installable Add-ins for Access

You can also create add-ins that the user can load (install) or unload (uninstall) by using the Add-In Manager. The Add-In Manager can load the following types of add-ins:

In order to load or unload one of these add-ins, the Add-in Manager relies on the presence of a table within the add-in, called the USysRegInfo table. The USysRegInfo table provides information that the Add-In Manager writes to the registry. Access uses this registry information to launch the add-in in response to an action taken by the user.

Note   The USysRegInfo table is a system table and is therefore usually hidden. To view system tables, click Options on the Tools menu, click the View tab, and then select the System objects check box.

You must create the USysRegInfo table; it's not automatically created for you when you create a new .mda file. The USysRegInfo table must contain the four fields described in the following table.

Field Field type Description
Subkey Text The name of the subkey that contains the registry information for the add-in
Type Number The type of value to create beneath the subkey: subkey (0), String (1), or DWORD (4)
ValName Text The name of the registry entry to be created
Value Text The value to be stored in the registry entry defined by the ValName field

Each record in the USysRegInfo table describes a subkey or value that is to be added to the registry for a particular add-in. The table can contain information for multiple add-ins.

For each add-in, the USysRegInfo table must contain a minimum of three records: one to create the subkey for the add-in, one to add the Library entry, and one to add the Expression entry. Note that these are the same values required to create a menu add-in, as described in the previous section. You can add other records to store additional values in the registry. For example, you might add a record that creates a registry entry that indicates where a bitmap file required by the add-in is stored.

In the Subkey field, you can use the "HKEY_CURRENT_ACCESS_PROFILE\AddInType\AddInName" string to create the new registry entry. The Add-in Manager uses this string to determine the location on the user’s machine of Access-specific information in the registry so that Access can create the entry for the add-in in the appropriate place. If the user started Access with the /profile command-line option, this string ensures that the registry entry is created beneath the specified Access user profile; otherwise, the entry is created under the \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Access\AddInType subkey in the registry. For more information about starting Access from the command line with the /profile option, search the Microsoft Access Help index for "user profiles."

Note   A user profile that you use to start Access from the command line is not the same thing as a user profile that's defined for logging on to the operating system. An Access user profile applies only to Access, and only when you start Access from the command line. A user profile defined for the operating system applies to every application on the system, and is used to maintain system data for individual users.

You can also use the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Access\AddInType" string to specify that the registry entries for the add-in should always be created under this registry subtree and that Access user profiles are to be ignored. Note that in this case you need to include the full registry path to the add-in's subkey

Figure 11.2 shows the USysRegInfo table included in the sample add-in, Create Procedures Table (ProcTable.mda), available in the ODETools\V9\Samples\OPG\Samples\CH11 subfolder on the Office 2000 Developer CD-ROM. You can import this table into your own add-in to give you a start on creating a USysRegInfo table.

Figure 11.2 Sample USysRegInfo Table

For more information about creating the USysRegInfo table for the various types of add-ins, see USysReg.doc in the OPG\Appendixes folder on the Office 2000 Developer CD-ROM.