Property Builders

My LNC Rename add-in (originally created in Access 97 and updated for Access 2000) is still useful in Access 2007 running on Windows XP, because Microsoft has not yet implemented automatic object and control naming according to a naming convention. This add-in lets you automatically rename database objects and form and report controls according to the Leszynski Naming Convention. It includes several menu add-ins and two property builders, which run from the Name property of a control (for renaming a single control) or the Detail section of a form or report (for renaming all controls in a form or report).

For more details on the LNC Rename add-in, see my book Expert One-on-One Microsoft Access Application Development (ISBN: 0764559044).

Property builders require five rows in the USysReglnfo table, as described in the following list:

■ In the first row of the add-in, the Subkey field (which is the same for all the add-in's rows) has the Registry key information, referencing the Property Wizards section under the HKEY_CURRENT_ACCESS_PROFILE key (which references the currently running version of Access), and ending with the command name to display on the Add-Ins menu, with an ampersand if desired to make a hot key. The Type field has a value of 0, indicating the start of a new add-in. The ValName and Value fields are blank.

■ In the add-in's second row, the Type field has a value of 1, the ValName field has the value "Description", and the Value field has text to display on the Builder dialog — in the case of the LNCBuilder property wizard, that is the Choose Builder dialog opened from the Name property of a control's properties sheet.

■ In the add-in's third row, the Type field has a value of 4, the ValName field has the value "Can Edit", and the Value field has a value of 1, indicating that the wizard can be called for an existing object.

■ In the add-in's fourth row, the Type field has a value of 1, the ValName field has the value "Library", and the Value field has the location and name of the library database, using the |ACCDIR\ placeholder to point to the AddIns folder.

■ In the add-in's fifth row, the Type field has a value of 1, the ValName field has the value "Function", and the Value field has the name of the function to run (without an equals sign).

Table 14.5 lists the USysRegInfo rows for the property wizard for renaming a single control from the LNC Rename add-in.

TABLE 14.5

USysRegInfo Rows Needed for a Property Builder

Subkey

Type

ValName

Value

HKEY_CURRENT_ACCESS_PROFILE\Wizards\ Property Wizards\Name\LNC Builder

0

HKEY_CURRENT_ACCESS_PROFILE\Wizards\ Property Wizards\Name\LNC Builder

1

Description

LNC Rename Current Control

HKEY_CURRENT_ACCESS_PROFILE\Wizards\ Property Wizards\Name\LNC Builder

4

Can Edit

1

HKEY_CURRENT_ACCESS_PROFILE\Wizards\ Property Wizards\Name\LNC Builder

1

Library

|ACCDIR\LNC Rename.mda

HKEY_CURRENT_ACCESS_PROFILE\Wizards\ Property Wizards\Name\LNC Builder

1

Function

Strictly speaking, a library database contains add-ins (usually several), but usually the entire library database is referred to as an add-in.

0 0

Post a comment