Using a DBLookup control with a data source

You can use a DBLookup control with the Datasource control to which the DBLookup control is linked. When you set the properties for the DBLookup control from the Property Inspector, you can specify a data field (you can only select from fields that belong to the table that is linked to the data source) as well as the following properties:

  • Lookup display - Determines the field that is displayed by the field control.
  • Lookup ID - Determines the field that is actually retrieved.
  • Lookup popup - Determines the data source fields displayed in the DBLookup.
  • Lookup source - Links the DBLookup to a data source. The data source that you select determines the fields that can be selected from the Lookup display, Lookup ID, and Lookup fields.

For example, the following screen shows the Lookup popup, Lookup ID, Lookup display, and Lookup source values are set for the DBLookUp control:



In the above example, a data source and a Lookup source have been specified for the DBLookup control. The data source that is used by the DBLookup can differ from the Lookup source that you specify for the control.

For example, suppose that you want a user to select an Employee ID for a specific WFM user from the DBLookup. However, most users do not know which Employee IDs belong to which WFM users and cannot make an educated selection from the list. Therefore, use a Lookup source that is linked to the WORKBRAIN USER table so that the user can select from a list of recognizable WFM user names. The Datasource property for the control is linked to the EMPLOYEE table. This table contains a foreign key to the WORKBRAIN USER table. When users select a WFM user name from the DB Lookup, the information is passed to the Datasource and linked to the appropriate Employee ID.

Note: The database table that is linked to Lookup source must contain a foreign key to the database table that is linked to the Data Source. If the two tables do not share the same foreign key, the system cannot pass the data from the Lookup source to the Data Source.