How to create USysRegInfo table for installing add-ins in Microsoft Access (201735)



The information in this article applies to:

  • Microsoft Access 2000
  • Microsoft Access 2002
  • Microsoft Office Access 2003

This article was previously published under Q201735
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

Advanced: Requires expert coding, interoperability, and multiuser skills.

SUMMARY

This article describes how to create application-specific add-ins for Access. In Access, there are two different types of add-ins: application-specific add-ins and Component Object Model (COM) add-ins. An application-specific add-in works in only one application. COM add-ins can be used across all Microsoft Office applications. However, they are not as easy to build nor to distribute, and they require Microsoft Visual Basic, Microsoft Office 2000 Developer, or Microsoft Office XP Developer. Therefore, if your solution is for only one application, an application-specific add-in would meet your needs.

For a detailed description of how to develop a COM add-in, see the "Add-ins, Templates, Wizards, and Libraries" chapter in the Microsoft Office 2000/Visual Basic Programmer's Guide. To see this chapter, visit the following Microsoft Web site:

For an Office XP version previous chapter, visit the following Microsoft Web site:You can create an application-specific add-in database for the purpose of storing a wizard (or builder) that provides additional functionality to Access. In your add-in database, you can create a table called USysRegInfo that allows your wizard (or builder) to be installed by the Add-in Manager and opened from the Add-ins menu.

When you create the USysRegInfo table, you must follow strict guidelines for the structure of the table and the content of its records. This article provides step-by-step instructions for creating the USysRegInfo table.

MORE INFORMATION

When a wizard or builder is installed by the Add-in Manager, new entries or keys are created in the Windows Registry. The values for these keys are stored in the USysRegInfo table. For this reason, the USysRegInfo table must have only four fields with the following names and data types:
Field NameData TypeField Size
SubkeyText255
TypeNumberLong Integer
ValNameText255
ValueText255
The Type field specifies the type of registry entry: key (0), string (1), or DWORD (4).

The subkey entries in the USysRegInfo table will always begin with either HKEY_CURRENT_ACCESS_PROFILE or HKEY_LOCAL_MACHINE. If a user profile is in use when the Add-In Manager is invoked and the subkey entries begin with HKEY_CURRENT_ACCESS_PROFILE, then registry entries will be created under the keys for that particular profile. If no profile is in use at the time, then the registry entries will be created under HKEY_LOCAL_MACHINE. If HKEY_LOCAL_MACHINE is used instead, registry entries will always be written below HKEY_LOCAL_MACHINE.

NOTE: You do not have to create the USysRegInfo records in the same order that the guidelines in this article present. However, the first record that you create for each wizard should always be the record that has a 0 in the Type field and blanks in the ValName and Value fields.

Procedures to Create USysRegInfo Records for Menu Add-ins

NOTE: This article assumes that HKEY_CURRENT_ACCESS_PROFILE will be used to begin the text for all the subkey field values but, if appropriate for your wizard, this may be changed to HKEY_LOCAL_MACHINE.
  1. Four records must be added to the USysRegInfo table. The values in the subkey field for all four records should be:

    HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\<Menu Add-in Name>

    Replace <Menu Add-in Name> with the name that you want to appear in the Add-ins submenu of the Access user interface. This is also the name of the registry key where values are written.
  2. The first of the four records should have 0 for the Type field and the ValName and Value fields should be blank. This record simply signifies to the Add-in Manager that registry keys will be added. This applies to each type of wizard described in this article.
  3. The second record should have a 1 in the Type field and Expression in the ValName field. The Value field should have an equals sign, followed by the name of the function that will start the Menu Add-in. For example:

    =Sample_Menu_Addin()

    NOTE: If the equal sign is missing, Access tries to run a macro in the user's database rather than a function in the add-in database.

  4. The third record should have a 1 in the Type field and Library in the ValName field. The Value field should contain the path and name of the add-in database. The path is represented by |ACCDIR\, which signifies the path to the folder where Access is installed. For example:

    |ACCDIR\wzaddin.mda

  5. The fourth record is new in Access 2000 or later version. It indicates in what file types the Add-In should be visible. It should have a 1 in the Type field and Version in the ValName field. The Value field should contain one of the following integers:

    1- Show this Add-in in MDBs (Jet) only (default).
    2- Show this Add-in in ADPs (Client/Server) only.
    3- Show this Add-in in both MDBs (Jet) and ADPs (Client/Server).

Procedures to Create USysRegInfo Records for Form and Report Wizards

NOTE: This article assumes that HKEY_CURRENT_ACCESS_PROFILE will be used to begin the text for all the subkey field values but, if appropriate for your wizard, this may be changed to HKEY_LOCAL_MACHINE.
  1. You must add eight records to the USysRegInfo table to define the registry values for form and report wizards. The values in the subkey fields for all the records should be:

    HKEY_CURRENT_ACCESS_PROFILE\Wizards\<WizardType>\<WizardName>

    The <WizardType> can be Form Wizards or Report Wizards. <WizardName> is the name that you want to display in the New Object dialog box (where the user chooses which wizard to run) and it is also the name of the registry key where values will be written.
  2. The first of the eight records should have 0 for the Type field and the ValName and Value fields should be blank. This record simply signifies to the Add-In Manager that registry keys will be added. This applies to each type of wizard described in this article.
  3. The second record should have a 1 in the Type field and the ValName field should have Bitmap. The value field should contain the path to the bitmap (.bmp) that is displayed above the description on the left side of the New Object dialog box. The wizard will still be installed if this record is not included, but no graphic will appear in the New Object dialog box.
  4. The third record should have a 4 in the Type field and the ValName field should have Datasource Required. The value field can be either 1 or 0, and it defines whether or not the user must choose a table or query from which the form or report wizard will obtain its data. A value of 1 signifies that a table or query must be chosen.
  5. The fourth record should have a 1 in the Type field and the ValName field should have Description. The value field should contain user-defined text that describes the wizard. The description is displayed on the left side of the New Object dialog box.
  6. The fifth record should have a 1 in the Type field and the ValName field should have Function. The value field should contain the name of the function that is used to start the wizard. Unlike Menu Add-ins, an equal sign does not precede the function name and open and close parentheses should not follow the function name.
  7. The sixth record should have a 4 in the Type field and the ValName field should have Index. The Value field should have a number that signifies the order in which the wizard will appear in the wizards list in the New Object Dialog box. A value of 0 signifies the first item in the list.
  8. The seventh record should have a 1 in the Type field and the ValName field should have Library. The Value field should contain the path and name of the add-in database. The path is represented by |ACCDIR\, which signifies the path to the folder where Access is installed. For example:

    |ACCDIR\wzaddin.mda

  9. The eighth and final record indicates in what file types the Add-in should be visible. It should have 1 in the Type field and Version in the ValName field. The Value field should contain one of the following integers:

    1- Show this Add-in in MDBs (Jet) only (default).
    2- Show this Add-in in ADPs (Client/Server) only.
    3- Show this Add-in in both MDBs (Jet) and ADPs (Client/Server).

Procedures to Create USysRegInfo Records for Table and Query Wizards

NOTE: This article assumes that HKEY_CURRENT_ACCESS_PROFILE will be used to begin the text for all the subkey field values; but, if appropriate for your wizard, this may be changed to HKEY_LOCAL_MACHINE.
  1. You must add seven records to the USysRegInfo table to define the registry values for table and query wizards. The values in the subkey fields for all records should be:

    HKEY_CURRENT_ACCESS_PROFILE\Wizards\<WizardType>\<WizardName>

    The <WizardType> can be Query Wizards or Table Wizards. <WizardName> is the name that you want to display in the New Object dialog box (where the user chooses which wizard to run) and it is also the name of the registry key where values will be written.
  2. The first of the seven records should have 0 for the Type field and the ValName and Value fields should be blank. This record simply signifies to the Add-in Manager that registry keys will be added. This applies to each type of wizard described in this article.
  3. The second record should have a 1 in the Type field and the ValName field should have Bitmap. The value field should contain the path to the bitmap (.bmp) that is displayed above the description on the left side of the New Object dialog box. The wizard will still be installed if this record is not included but no graphic will appear in the New Object dialog box.
  4. The third record should have a 1 in the Type field and the ValName field should have Description. The Value field should contain user-defined text that describes the wizard. The description is displayed on the left side of the New Object dialog box.
  5. The fourth record should have a 1 in the Type field and the ValName field should have Function. The value field should contain the name of the function that is used to start the wizard. Unlike Menu Add-ins, an equal sign does not precede the function name and open and close parentheses should not follow the function name.
  6. The fifth record should have a 4 in the Type field and the ValName field should have Index. The Value field should have a number that signifies the order in which the wizard will appear in the wizards list in the New Object dialog box. A value of 0 signifies the first item in the list.
  7. The sixth record should have a 1 in the Type field and the ValName field should have Library. The Value field should contain the path and name of the add-in database. The path is represented by |ACCDIR\, which signifies the path to the folder where Access is installed. For example:

    |ACCDIR\wzaddin.mda

  8. The seventh and final record indicates in what file types the Add-in should be visible. It should have a 1 in the Type field and Version in the ValName field. The Value field should contain one of the following integers:

    1- Show this Add-in in MDBs (Jet) only (default).
    2- Show this Add-in in ADPs (Client/Server) only.
    3- Show this Add-in in both MDBs (Jet) and ADPs (Client/Server).

Procedures to Create USysRegInfo Records for Control Wizards, Property Wizards, or OLE Custom Control Wizards

NOTE: This article assumes that HKEY_CURRENT_ACCESS_PROFILE will be used to begin the text for all the subkey field values but, if appropriate for your wizard, this may be changed to HKEY_LOCAL_MACHINE.
  1. You must add six records to the USysRegInfo table to define the registry values for Control Wizards, Property Wizards, or OLE Custom Control Wizards. The values in the subkey fields for all four records should be:

    HKEY_CURRENT_ACCESS_PROFILE\Wizards\<WizardType>\<SubType>\<WizardName>

    The <WizardType> can be Control Wizards, Property Wizards, or OLE CUSTOM CONTROL WIZARDS (must be in all uppercase). The <SubType> will depend upon the <WizardType>.

    The following are valid subtypes for Control Wizards:
       Label, TextBox, OptionGroup, ToggleButton, OptionButton, CheckBox,
       ComboBox, ListBox, CommandButton, Image, UnboundObjectFrame,
       BoundObjectFrame, PageBreak, SubformSubreport, Line, Rectangle
    The following are examples of subtypes that can be used with Property Wizards:
       BackColor, BorderColor, FieldName, ForeColor, InputMask,
       LinkChildFields, LinkMasterFields, MenuBar, Module, ODBCConnectStr,
       Picture, ShortcutMenuBar
    The subtype for OLE Custom Control Wizards is the Class property of the OLE custom control. To see this value, open a form or report in Design view, use the right mouse button to click the OLE custom control, click Properties, and then read the value in the Class box.

    The <WizardName> is the name of the registry key where values will be written.
  2. The first of the six records should have 0 for the Type field and the ValName and Value fields should be blank. This record simply signifies to the Add-in Manager that registry keys will be added. This applies to each type of wizard described in this article.
  3. The second record should have a 4 in the Type field and the ValName field should have Can Edit. The value field defines whether or not the wizard can be used to modify an existing control or property or if it will only be used to write new ones. A value of 1 signifies that the wizard can be used to modify.
  4. The third record should have a 1 in the Type field and the ValName field should have Description. The value field should contain user-defined text that describes the wizard. The description is displayed in the Choose Builder dialog box (if more than one wizard has been defined).
  5. The fourth record should have a 1 in the Type field and the ValName field should have Function. The Value field should contain the name of the function used to start the wizard or builder. Unlike Menu Add-ins, an equal sign does not precede the function name and open and close parentheses should not follow the function name.
  6. The fifth record should have a 1 in the Type field and the ValName field should have Library. The value field should contain the path and name of the add-in database. The path is represented by |ACCDIR\, which signifies the path to the folder where Access is installed. For example:

    |ACCDIR\wzaddin.mda

  7. The sixth and final record indicates in what file types the add-in should be visible. It should have a 1 in the Type field and Version in the ValName field. The Value field should contain one of the following integers:

    1- Show this Add-in in MDBs (Jet) only (default).
    2- Show this Add-in in ADPs (Client/Server) only.
    3- Show this Add-in in both MDBs (Jet) and ADPs (Client/Server).

After you create the USysRegInfo table, a user can use the Add-in Manager to install the wizards that you have created. To install the wizards with the Add-in Manager:
  1. On the Tools menu, point to Add-ins and then click Add-in Manager.
  2. Select the appropriate add-in from the list of available add-ins. If the add-in database had not been copied to the user's Access folder, it will not appear in the list. However, you can click Add New to locate the add-in database and select it. It is then copied to the Access folder and subsequently appears in the available add-ins list.
  3. Click Install. The Add-in manager creates registry entries based on the USysRegInfo table, and then your wizards are installed.

REFERENCES

For more information, see Chapter 11, "Add-ins, Wizards, Libraries and Templates," in The Microsoft Office 2000/Visual Basic Programmer's Guide.

Modification Type:MajorLast Reviewed:12/18/2004
Keywords:kbhowto kbusage KB201735