After you have completed the initial phase of testing and debugging, you’re almost ready to install your add-in by using the Add-in Manager, which is available from the Add-ins submenu (Tools menu). Your users will also use the Add-in Manager to install your add-in.
After your add-in is installed, its name appears in the appropriate place in Microsoft Access. If your add-in is a form wizard, for example, it appears in the list of form wizards that users see when creating a new form. Users can run your add-in by choosing it from the list.
However, before you can use the Add-in Manager, you must first set several database properties and create a USysRegInfo table in your add-in’s database.
The first step in preparing your add-in for installation is to set database properties which provide general information about your add-in.
Û To set database properties before you install your add-in
When users install your add-in, the Add-in Manager uses a table in the add-in’s database named USysRegInfo to determine what type of add-in to install and to get general information about the add-in to display for your users. You create the USysRegInfo table in the database that contains the add-in, and then you add records that give the Add-in Manager the information it needs to install your add-in.
Note Table names that start with USys or MSys are system tables that aren’t displayed in the Database window unless you select the System Objects check box on the View tab of the Options dialog box (Tools menu). The built-in Microsoft Access system tables all start with MSys. You can use the prefix USys to create your own system tables and hide them by clearing the System Objects check box.
The simplest way to create a USysRegInfo table is to import the table from one of the wizards that comes with Microsoft Access.
Û To create the USysRegInfo table
Microsoft Access displays the system tables (tables with names that start with MSys or USys) in the Database window. With system objects showing, your USysRegInfo table will be displayed in the list of tables in the Database window.
Microsoft Access displays the Import dialog box.
Microsoft Access displays the Import Objects dialog box.
Microsoft Access imports the table.
The USysRegInfo table imported from Wztool80 is empty. You now need to add the records that will register your add-in. The next section describes how to do this.
After you have imported a copy of the USysRegInfo table from Wztool80, you need to add records to the table. There are four fields in your USysRegInfo table: Subkey, Type, ValName, and Value. When you add records to the table, you define values in these fields as described in the following sections.
The value in the Subkey field defines the names of the subkeys that the Add-in Manager creates in the Windows Registry to register your add-in. This value must be the same for all records in the USysRegInfo table. The value you enter in the Subkey field consists of two parts; the first part is called the root key, which is followed by the subkeys below it.
The root key can be either HKEY_CURRENT_ACCESS_PROFILE or HKEY_LOCAL_MACHINE. If you use HKEY_CURRENT_ACCESS_ PROFILE and the installation is using a user profile (an alternate set of Windows Registry keys that is invoked when Microsoft Access is started with the /profile command-line option), the Add-in Manager adds the keys and values required to register the add-in in the user profile. If you use HKEY_CURRENT_ACCESS_ PROFILE and a user profile is not in use, the Add-in Manager adds the keys and values required to register the add-in in the appropriate key below HKEY_LOCAL_ MACHINE. If you want to make sure that your add-in is registered for all users of Microsoft Access, use HKEY_LOCAL_MACHINE as your root key. If you use HKEY_LOCAL_MACHINE, the Add-in Manager always adds the keys and values to register the add-in in the appropriate key below HKEY_LOCAL_MACHINE.
The format of the second part of this entry depends on the kind of add-in you’re installing.
Entering the Subkey Value for Control Wizards, ActiveX Control Wizards, or Builders
If the Control Wizards tool in the toolbox is pressed in, a control wizard is invoked when a user adds a control to a form or report with one of the control tools in the toolbox. An ActiveX control wizard is invoked when a user adds an ActiveX control, formerly called OLE controls or custom controls, to a form or report with the More Controls tool in the toolbox. A builder is invoked when a user clicks the Build button next to a property box in a property sheet. To register a control wizard, ActiveX control wizard, or builder, the format for the value you enter in the Subkey field is:
HKEY_CURRENT_ACCESS_PROFILE\Wizards\WizardType\WizardSubType\WizardName
Note that the first part of the value you enter in the Subkey field can be either HKEY_CURRENT_ACCESS_PROFILE or HKEY_LOCAL_MACHINE, as described earlier. The second part of the entry must begin with Wizards. Assuming there is no user profile in use, this causes the Add-in Manager to write the keys and values to register the wizard or builder in the HKEY_LOCAL_MACHINE \SOFTWARE\Microsoft\Office\8.0\Access\Wizards key. WizardType defines whether the add-in is a control wizard, ActiveX control wizard, or a builder (called a property wizard in the Windows Registry). WizardSubType defines the specific type of wizard. WizardName is the name of the key where the values to register the wizard or builder will be added.
Note WizardName must follow Microsoft Access object-naming rules. For information on Microsoft Access object-naming rules, search the Help index for “naming conventions.”
The following table describes the possible values for WizardType and WizardSubType.
WizardType | WizardSubType |
Control Wizards | The name of the tool in the toolbox that creates the control you want to associate your wizard with. This must be the name of the tool without spaces. The names of the tools are: Label, TextBox, OptionGroup, ToggleButton, OptionButton, CheckBox, ComboBox, ListBox, CommandButton, Image, UnboundObjectFrame, BoundObjectFrame, PageBreak, TabControl, SubformSubreport, Line, and Rectangle. |
ActiveX Control Wizards | The value of 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, and then read the value in the Class box. For example, DBOutl.DataOutline is the value of the Class property for the Microsoft Data Outline Control 1.1 included with Microsoft Access. |
Property Wizards | The name of the property that you want the builder to be associated with. This must be the name of the property without spaces. For example, the names entered for standard Microsoft Access builders are: BackColor, BorderColor, FieldName, ForeColor, InputMask, MenuBar, LinkChildFields, LinkMasterFields, ODBCConnectStr, Picture, and ShortcutMenuBar. |
An object wizard is used to create a table, query, form, or report. An object wizard is invoked when a user clicks its name in the corresponding New Object dialog box. To register an object wizard, the format for the value you enter in the Subkey field is:
HKEY_CURRENT_ACCESS_PROFILE\Wizards\WizardType\WizardName
Note that the first part of the value you enter in the Subkey field can be either HKEY_CURRENT_ACCESS_PROFILE or HKEY_LOCAL_MACHINE, as described earlier. The second part must begin with Wizards. Assuming there is no user profile in use, this causes the Add-in Manager to write the keys and values to register the wizard in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft \Office\8.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 key where the values to register the wizard will be added. The following table describes the possible values for WizardType and WizardName.
WizardType | WizardName |
Form Wizards | User-defined. The name you enter will be displayed in the New Form dialog box. For example, the names entered for standard 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 standard 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 standard 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 standard Microsoft Access table wizard is: Table Wizard. |
A menu add-in is invoked when a user clicks its name on the Add-ins submenu (Tools menu.) To register a menu add-in, the format for the value you enter in the Subkey field is:
HKEY_CURRENT_ACCESS_PROFILE\Menu Add-Ins\MenuAddInName
Note that the first part of the value you enter in the Subkey field can be either HKEY_CURRENT_ACCESS_PROFILE or HKEY_LOCAL_MACHINE, as described earlier. The second part must begin with Menu Add-Ins. Assuming there is no user profile in use, this will cause the Add-in Manager to write the keys and values to register the menu add-in in HKEY_LOCAL_MACHINE\SOFTWARE \Microsoft\Office\8.0\Access\Menu Add-Ins. MenuAddInName defines the name that displays on the Add-ins submenu and is also the name of the key where the values to register the add-in will be added. 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.
No matter what kind of add-in you’re installing, for the first record, the value in the Type field must be 0 (which means “add this key”), and the ValName and Value fields must be left blank.
The first record in the USysRegInfo table creates a key or keys used to register your add-in. Each record following the first record defines a value added to the last key in the Windows Registry subtree. The value in the Subkey field must be the same for all records in the table. You can simply copy the value you entered in the Subkey field of the first record to the subsequent records.
The value in the Type field defines the type of the value created in the Windows Registry; you can either enter 1 to create a String value (REG_SZ in Windows NT Workstation 3.51) or 4 to create a DWORD value (REG_DWORD in Windows NT Workstation 3.51).
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 table describes the records you need to add to define values for control wizards, builders, or ActiveX control wizards.
Type | ValName | Value |
4 | Can Edit | Specifies whether or not a wizard or builder can be used to modify an existing control or property of the same type. 1 = Yes, 0 = No. |
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 appears in the Choose Builder dialog box so that users can select which wizard or builder to use. |
1 | Function | The function used to start the wizard or builder. |
1 | Library | Specifies the path and name of the add-in database: |ACCDIR\AddInDBName.mda. The first part is always the same. The Add-in Manager will substitute the path to the folder where Microsoft Access is installed. The second part is the name of the database that contains your wizard or builder. |
The following table describes the records you need to add to define values for object wizards.
Type | ValName | Value |
1 | Bitmap | Specifies 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. |
4 | Datasource Required | Enter this record for form and report wizards only. Specifies whether the user must specify the table or query where the object’s data comes from in the New Object dialog box before running the wizard. 1 = Yes, 0 = No. |
1 | Description | User-defined. Specifies the text that is displayed on the left side of the New Object dialog box when the wizard is selected. |
1 | Function | The function used to start the wizard or builder. |
4 | Index | Specifies 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. |
1 | Library | Specifies the path and name of the add-in database: |ACCDIR\AddInDBName.mda. The first part is always the same. The Add-in Manager substitutes the path to the folder where Microsoft Access is installed. The second part is the name of the database that contains your wizard. |
The following table describes the records you need to add to define values for menu add-ins.
Type | ValName | Value |
1 | Expression | User-defined. The name of the function used to start the wizard or builder formatted as an expression: =FunctionName() |
1 | Library | Specifies the path and name of the add-in database: |ACCDIR\AddInDBName.mda. The first part is always the same. The Add-in Manager substitutes the path to the folder where Microsoft Access is installed. The second part is the name of the database that contains your menu add-in. |
After you create your add-in and add the USysRegInfo table, you and your users can install the add-in by using the Add-in Manager.
Û To install an add-in using the Add-in Manager
Microsoft Access displays the Add-in Manager dialog box.
Microsoft Access copies the add-in to your Office folder and adds it to the list in the Available Add-ins box.
The Add-in Manager installs the add-in, and puts an x beside the add-in in the list. If the database doesn’t contain a USysRegInfo table, then the Add-in Manager generates an error.
To uninstall an add-in using the Add-in Manager, click the add-in in the Available Add-ins box and click Uninstall.
Once you have installed your add-in, you need to perform the second phase of testing and debugging.
See Also For information on testing and debugging your add-in, see “Testing and Debugging Your Add-in” earlier in this chapter.