At design time, create a Data control (datCountries). This control determines the choices allowed in the DBCombo's dropdown list. Set the RecordSource property to the SQL query or table name that will select the values that are allowed in the DBCombo.
Create another Data control (datCompanies). This control determines the values selected for the fields bound for a particular record. Set its RecordSource property to select the data you want to display.
In this program, for example, the datCompanies control selects values from the Companies table including one field named Country. Each record in the Companies table has a single value in the Country field. That value must be one of those listed in the Countries table selected by datCountries.
Next create a DBCombo control (and any other controls you want bound to datCompanies). Set its DataSource property to the Data control that selects the records you want to display (datCompanies) and set the DataField property to the field that should be displayed by the DBCombo (Country).
Now set the RowSource property to the Data control that selects the allowed values for the DBCombo (datCountries) and set its ListField property to the field selected by that Data control that contains the allowed values. In this example, that is the field called Name in the Countries table.
Property | Value |
DataSource | datCompanies |
DataField | Country |
RowSource | datCountries |
ListField | Name |
Finally, at runtime, attach the Data controls to the databases (you could do this at design time if you knew the databases wouldn't move later). Note that in this program both tables are in the same database.
|