The DBCombo fills its ComboBox list using a database table. The real work is done at design time.
The datCompanies Data control has a RecordSource of Companies, indicating it selects data from the Companies table. This is the main Data control that displays company records.
The datCountries Data control has a RecordSource of Countries, indicating it selects data from the Countries table. This control selects all of the allowed Country values.
The two TextBoxes have DataSource set to datCompanies and DataField values of Name and Description respectively. As the datCompanies control navigates the Countries table, these fields display the current record's Name and Description fields.
The DBCombo has DataSource set to datCompanies and DataField set to Country. As the datCompanies control navigates the Countries table, this control displays the current record's Country field.
The DBCombo has RowSource set to datCountries and ListField set to Name. This tells the DBCombo what choices are allowed. When the user clicks on the DBCombo to edit a record's Country value, the control allows only the Name values selected by the datCountries control.
|