Lookup Forms
Some fields on forms enable users to select a value from a different form. These controls are shown with a Lookup button next to them (
). When the user clicks the arrow, a Lookup form opens. The Lookup form shows possible values for the field and supporting information to help users make the correct choice. For example, if users need to select an account number, the Lookup form might also show the Customer Name field to help them select the correct account number.
The contents of Lookup forms are based on relations set up on the database table and/or the extended data type for a field.
Lookup forms consist of the following components:
-
TitleField1 from the related table (set by the TitleField1 property)
-
TitleField2 from the related table (set by the TitleField2 property)
-
The fields that make up the relation
If any of these fields are identical, the system automatically omits duplicates.
For information about how to create a standard Lookup form, see Create Lookup Forms.
To display different fields in the Lookup form, you need to override the lookup method on the form control. For more information, see Creating runtime lookup forms.
The presence of the Lookup button on the control in the parent form is controlled by the LookupButton property on the control. The default Auto setting for the property means that a button is displayed if any relations have been set up for the field.
To open the Lookup form in the following figure, click the Lookup button on the Customer group field on the General tab in the CustTable form.
.gif)
The Lookup information is based on the relation on the CustGroupId extended data type used for the CustGroup field, as shown in the following figure.
.gif)
TitleField1 and TitleField2 from the CustGroup table (the related table) are CustGroup and Name, as shown in the following figure.
.gif)
Following are the components of the Lookup form:
-
The CustGroup field is specified in the TitleField1 property on the CustGroup table. The label for this field is Customer group.
-
The Name field is specified in the TitleField2 property on the CustGroup table. The label for this field is Description.
-
The CustGroup field is specified as the relation on the CustGroupId extended data type. Because the CustGroup field is also used for TitleField1, only two fields are shown in the Lookup form.