Creating the USysRegInfo Table for a Microsoft Access 2000 Add-In

Microsoft Corporation

January 1999

Summary: This document contains information about creating the USysRegInfo table required by the Microsoft® Access Add-in Manager to install and manage an add-in. (10 printed pages)

Creating the USysRegInfo Table

When developing your own add-in (a wizard, builder, or menu add-in), you must create a table named USysRegInfo in the add-in database (*.mda or *.mde) so that the add-in can be installed by using the Add-in Manager. You can create a new USysRegInfo table from scratch or import one from another add-in.

The USysRegInfo table is usually a hidden table, because it provides information to the system but doesn't contribute to other data in the database. To mark the USysRegInfo table as a hidden object, right-click the table in the Database window, click Properties on the shortcut menu, and select the Hidden check box.

The following table describes the fields that must be included in the USysRegInfo table:

Field name Data type Description
Subkey Text The name of the subkey that the Add-In Manager will create in the registry for your add-in.
Type Number Defines the type of the value created in the registry: Use 0 to create a subkey, 1 to create a String, or 4 to create a DWORD.
ValName Text The name of the entry to be created in the registry.
Value Text The value to be stored in the registry entry defined in the ValName field.

The USysRegInfo table can contain information for multiple add-ins.

The First Record: Creating the Registry Key

The value in the Subkey field defines the name of the subkey that will be created in the Windows registry to register the add-in. This value must be the same for all records in the USysRegInfo table describing that add-in.

No matter what kind of add-in you're installing, the value in the Type field must be 0 for the first record. This value specifies that the subkey is to be added to the registry. Also, the ValName and Value fields must be left blank for the first record. The beginning of the Subkey entry can be either HKEY_CURRENT_ACCESS_PROFILE or HKEY_LOCAL_MACHINE.

If you use HKEY_CURRENT_ACCESS_PROFILE and start Microsoft Access by using an Access user profile (an alternate set of registry subkeys that is invoked when Microsoft Access is started with the /profile command-line option), the Add-in Manager will add the subkeys and values required to register the add-in in the Access user profile. In this case, the registry subkeys are written to the following subkey:

HKEY_LOCAL_MACHINE\SOFTWARE\CompanyName\ApplicationName\ApplicationVersion
\WizardType\WizardName

Note   A user profile that you use to start Microsoft Access from the command line is not the same thing as a user profile defined for logging into the operating system. An Access user profile applies only to Microsoft 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 operating system and is used to maintain system data for individual users.

If you use HKEY_CURRENT_ACCESS_PROFILE and an Access user profile is not in use, the Add-in Manager will add the subkeys and values required to register the add-in in the default Access subkey below HKEY_LOCAL_MACHINE:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Access\WizardType\WizardName 

In general, it's a good idea to use HKEY_CURRENT_ACCESS_PROFILE so that the add-in will be registered for the appropriate Access user profile, if one is in use. Use HKEY_LOCAL_MACHINE only if you want to force the add-in to be registered under the default Access subkey.

For example, the value for the Subkey field for a menu add-in named Form Analyzer would be:

HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\&Form Analyzer

Note   The ampersand (&) indicates which letter is the access key.

This would be the value for the Subkey field for every record that describes that add-in.

If you want to write the subkey to the default Access subkey beneath HKEY_LOCAL_MACHINE, the value for the Subkey field would be as follows:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Access\Menu Add-Ins\&Form Analyzer

Subkey Format for Control Wizards, ActiveX Control Wizards, or Builders

A control wizard is invoked from the toolbox when you click one of the control tools while designing a form or report. A builder is invoked when you click the Build button (…) next to a property box. An ActiveX® control wizard is invoked when you add an ActiveX control by clicking ActiveX Control on the Insert menu in form Design view. To register a control wizard, a builder, or an ActiveX control wizard, the format for the Subkey field is:

HKEY_CURRENT_ACCESS_PROFILE\Wizards\WizardType\WizardSubType\WizardName

The first part can be either HKEY_CURRENT_ACCESS_PROFILE or HKEY_LOCAL_MACHINE, as described earlier. The second part must be Wizards. Assuming there is no user profile in use, this will cause the Add-in Manager to write the subkeys and values to register the wizard or builder in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Access\Wizards. WizardType defines whether the add-in is a control wizard, a builder (called a Property Wizard in the registry), or an ActiveX control wizard. WizardSubType defines the specific type of wizard. WizardName is the name of the subkey where the values to register the wizard or builder will be written. Note that WizardName must follow the Microsoft Access object-naming rules. The following table describes the possible values for WizardType and WizardSubType.

WizardType values WizardSubType values
Control Wizards The name of the control in the toolbox that you want to associate your wizard with. The names of the controls are Label, TextBox, OptionGroup, ToggleButton, OptionButton, CheckBox, ComboBox, ListBox, CommandButton, Image, UnboundObjectFrame, BoundObjectFrame, PageBreak, TabControl, SubformSubreport, Line, Rectangle.
Property Wizards The name of the property that you want the builder to be associated with. This must be the name of the property with no spaces. For example, the names entered for standard Microsoft Access builders are BackColor, BorderColor, FieldName, ForeColor, InputMask, LinkChildFields, LinkMasterFields, MenuBar, ODBCConnectStr, Picture, ShortcutMenuBar.
ActiveX CUSTOM CONTROL WIZARDS (must be all uppercase) The value for the Class property of the ActiveX control. To see this value, open a form or report in Design view, right-click the ActiveX control, click Properties on the shortcut menu, and then read the value in the Class property box.

Subkey Format for Object Wizards

An object wizard is used to create a table, query, form or report. An object wizard is invoked by clicking its name in the corresponding New Object dialog box. When you are registering an object wizard, the format for the Subkey field is:

HKEY_CURRENT_ACCESS_PROFILE\Wizards\WizardType\WizardName

The first part can be either HKEY_CURRENT_ACCESS_PROFILE or HKEY_LOCAL_MACHINE, as described earlier. The second part must be Wizards. Assuming there is no user profile in use, this will cause the Add-in Manager to write the subkeys and values to register the wizard in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ Office\9.0\ Access\Wizards. WizardType defines what kind of object wizard is being installed. WizardName is the name that displays in the corresponding New Object dialog box and is also the name of the subkey where the values to register the wizard will be written. The following table describes the possible values for WizardType and WizardName.

WizardType values WizardName values
Form Wizards User-defined. The name you enter will be displayed in the New Form dialog box. For example, the names entered for the built-in Microsoft Access form wizards are AutoForm: Columnar, AutoForm: Datasheet, AutoForm: Tabular, Chart Wizard, Form Wizard, PivotTable Wizard.
Query Wizards User-defined. The name you enter will be displayed in the New Query dialog box. For example, the names entered for the built-in Microsoft Access query wizards are Crosstab Query Wizard, Find Duplicates Query Wizard, Find Unmatched Query Wizard, Simple Query Wizard.
Report Wizards User-defined. The name you enter will be displayed in the New Report dialog box. For example, the names entered for the built-in Microsoft Access report wizards are AutoReport: Columnar, AutoReport: Tabular, Chart Wizard, Label Wizard, Report Wizard.
Table Wizards User-defined. The name you enter will be displayed in the New Table dialog box. For example, the name entered for the built-in Microsoft Access table wizard is Table Wizard.
Data Access Page Wizards User-defined. The name you enter will be displayed in the New Data Access Page dialog box. For example, the names entered for the built-in Microsoft Access data access page wizards are Page Wizard and AutoPage: Columnar.

Subkey Format for Menu Add-Ins

A menu add-in is invoked by clicking its name on the Add-ins submenu on the Tools menu.

HKEY_CURRENT_ACCESS_PROFILE\Menu Add-Ins\MenuAddInName

The first part can be either HKEY_CURRENT_ACCESS_PROFILE or HKEY_LOCAL_MACHINE, as described earlier. The second part must be Menu Add-Ins. Assuming there is no user profile in use, this will cause the Add-in Manager to write the subkeys and values to register the menu add-in in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Access\Menu Add-Ins. MenuAddInName defines the name that displays on the Add-ins submenu and is also the name of the subkey where the values to register the add-in will be written. To define an access key for the menu add-in so that you can use the keyboard to choose the menu add-in, type an ampersand (&) before the letter that you want to be the access key.

Second and Subsequent Records: Adding Records to Create Values

The first record in the USysRegInfo table creates a subkey or subkeys used to register your add-in. Each record following the first record defines a value written to the last subkey in the subtree. The value in the Subkey field must be the same as the entry for the first record. The value in the Type field defines the type of the value created in the registry: 1 to create a String or 4 to create a DWORD. The value in the ValName field defines the name of the value. The value in the Value field defines the value itself. The number of records you need to add depends on the type of add-in you are registering. The following tables define the records you need to add for each type of add-in.

Records Required to Define Values for Control Wizards, ActiveX Control Wizards, or Builders

Subkey field value Type field value ValName field value Value field value
Same as first record 4 Can Edit Defines if a wizard or builder can be used to modify an existing control or property of the same type. 1=Yes, 0=No.
Same as first record 1 Description User-defined. If more than one wizard has been defined for a control, or more than one builder has been defined for a property, this string will be displayed in the Choose Builder dialog box to enable users to select which wizard or builder to use.
Same as first record 1 Function The function used to start the wizard or builder.
Same as first record 1 Library Defines the path and name of the add-in database, which can be an .mda or .mde file. For example:

|ACCDIR\MyAddIn.mda

The first part is always the same. The Add-in Manager will substitute the path to the folder where Microsoft Access is installed.


Records to Define Values for Object Wizards

Subkey field value Type field value ValName field value Value field value
Same as first record 1 Bitmap Defines the path to the bitmap (.bmp) that is displayed above the description on the left side of the New Object dialog box when the wizard is selected.
Same as first record 4 Datasource Required Enter this record for form and report wizards only. Defines whether the user must choose a table or query from the Choose the table or query where the object's data comes from box in the New Object dialog box before running the wizard. 1=Yes, 0=No.
Same as first record 1 Description User-defined. Defines the text that is displayed on the left side of the New Object dialog box when the wizard is selected.
Same as first record 1 Function The function used to start the wizard or builder.
Same as first record 4 Index Defines the order in which the wizard is displayed in the list in the New Object dialog box, where 0 is the first item in the list.
Same as first record 1 Library Defines the path and name of the add-in database, which can be an .mda or .mde file. For example:

|ACCDIR\MyAddIn.mda

The first part is always the same. The Add-in Manager will substitute the path to the folder where Microsoft Access is installed.


Records to Define Values for Menu Add-ins

Subkey field value Type field value ValName field value Value field value
Same as first record 1 Expression The function used to start the wizard or builder formatted as an expression:

=MyAddIn_Entry()

Same as first record 1 Library Defines the path and name of the add-in database, which can be an .mda or .mde file. For example:

|ACCDIR\MyAddIn.mda

The first part is always the same. The Add-in Manager will substitute the path to the folder where Microsoft Access is installed.


Specifying Whether to Display the Add-In in a Database or in a Project

By default, Access add-ins appear in Access databases (.mdb files) only. If you want to make an add-in available from an Access project (.adp file) or from either an Access database or an Access project, you can add an additional record to the USysRegInfo table, as shown in the following table. If you omit this record, the add-in is displayed only in Access databases.

Record to Indicate Where Add-In Is Displayed

Subkey field value Type field value ValName field value Value field value
Same as first record 4 Version Set to 1 to display the add-in in Access databases (.mdb files) only; to 2 to display the add-in in Access projects (.adp files) only; and to 3 to display in both types of files.

Sample USysRegInfo Table

The following table shows how you could fill out the USysRegInfo table for a menu add-in named Form Analyzer.

Subkey Type ValName Value
HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\&Form Analyzer 0    
HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\&Form Analyzer 1 Library |ACCDIR\AnalyzeForms.mda
HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\&Form Analyzer 1 Expression =AnalyzeForms()

For more information about creating the USysRegInfo table or creating add-ins and wizards for Access, see Chapter 11, "Add-ins, Templates, Wizards, and Libraries," in the Microsoft Office 2000/Visual Basic® Programmer's Guide (Microsoft Press®, 1999).

--------------------------------------------

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, this paper should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.

Microsoft, ActiveX, Microsoft Press, Visual Basic, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.