ACC: How to Create a USysRegInfo Table for Installing Add-ins

ID: Q153858


The information in this article applies to:
  • Microsoft Access versions 7.0, 97


SUMMARY

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

You can create an add-in database for the purpose of storing a wizard (or builder) that provides additional functionality to Microsoft 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 to be opened from the Add-ins menu.

When you create the USysRegInfo table, you must follow strict guidelines for the table's structure 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 Name   Data Type   Field Size
   ----------   ---------   ----------
   Subkey       Text        255
   Type         Number      Long Integer
   ValName      Text        255
   Value        Text        255 

The field named Type 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 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 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. You must add three records to the USysRegInfo table. The values in the Subkey field for all three records should be
    
          HKEY_CURRENT_ACCESS_PROFILE\Menu Add-ins\<Menu Add-in Name> 

    where <Menu Add-in Name> is the name you want to appear in the Add-Ins submenu of the Microsoft Access user interface. This will also be the name of the registry key where values will be written to.


  2. The first of the three records should have 0 for the Type field and the ValName, and Value fields should be blank. This record 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 equal 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 not present, Microsoft Access will try 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 Microsoft Access is installed, for example:
    
          |ACCDIR\wzaddin.mda 



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 seven 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> 

    where <WizardType> can be Form Wizards or Report Wizards, and <WizardName> is the name that you want to display in the New Object dialog box (where the user chooses which wizard to run). <WizardName> 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 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 be 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 install 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 be 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 the user must choose a table or query.


  5. The fourth record should have a 1 in the Type field, and the ValName field should be 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 be Function. The value field should contain the name of the function that is used to start the wizard. Unlike with Menu Add-ins, an equal sign does not precede the function name, and opening and closing parentheses should not follow the function name.


  7. The sixth record should have a 4 in the Type field, and the ValName field should be 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 be 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 Microsoft Access is installed, for example:
    
          |ACCDIR\wzaddin.mda 


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 six 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> 

    where <WizardType> can be Query Wizards or Table Wizards, and <WizardName> is the name that you want to display in the New Object dialog box (where the user chooses which wizard to run). <WizardName> is also 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 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 be 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 install 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 be 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 be Function. The Value field should contain the name of the function that is used to start the wizard. Unlike with Menu Add-ins, an equal sign does not precede the function name, and opening and closing parentheses should not follow the function name.


  6. The fifth record should have a 4 in the Type field, and the ValName field should be 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 be 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 Microsoft Access is installed, for example:
    
          |ACCDIR\wzaddin.mda 


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 five 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> 

    where <WizardType> can be Control Wizards, Property Wizards, or OLE CUSTOM CONTROL WIZARDS (must be in all uppercase); where <SubType> will depend upon the <WizardType>; and where <WizardName> is the name of the registry key where values will be written.

    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.


  2. The first of the five records should have 0 for the Type field, and the ValName and Value fields should be blank. This record 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 be 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 be 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 be Function. The Value field should contain the name of the function used to start the wizard or builder. Unlike with Menu Add-ins, an equal sign does not precede the function name, and opening and closing parentheses should not follow the function name.


  6. The fifth record should have a 1 in the Type field, and the ValName field should be 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 Microsoft Access is installed, for example:
    
          |ACCDIR\wzaddin.mda 



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

After you create the USysRegInfo table, a user can use the Add-in manager to install the wizards you have created. To install the wizards with the Add-in Manager, follow these steps:
  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 Microsoft 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 will be copied to the Microsoft Access folder and will subsequently appear in the available add-ins list.


  3. Click Install. The Add-In manager will create registry entries based on the USysRegInfo table, and your wizards will be installed.



REFERENCES

"Building Applications with Microsoft Access for Windows 95," Chapter 16, "Creating Wizards, Builders, and Add-ins", pages 359-375

For more information about creating and testing Add-ins, please see the following articles in the Microsoft Knowledge Base:

Q143270 ACC95: Creating and Testing Add-ins Paper Available in Download Center

For more information about the UsysRegInfo table, search on "USysRegInfo" using the Microsoft Access for Windows 95 Help Index.

Keywords : kbusage WzAdmgr
Version : 7.0, 97
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: November 9, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.