Visual Basic: DataCombo/DataList Controls

DBCombo Control

See Also Example Properties Methods Events

The DBCombo control is a data bound combo box with a drop-down list box which is automatically populated from a field in an attached Data control, and optionally updates a field in a related table of another Data control. The text box portion of DBCombo can be used to edit the selected field.




The DBCombo control differs from the standard ComboBox control. While the ComboBox control list is filled using the AddItem method, the DBCombo control is automatically filled with data from a field in the Recordset object of a Data control to which it is attached. The standard ComboBox control must be populated manually by using the AddItem method. In addition, the DBCombo control has the ability to update a field within a related Recordset object which may reside in a different Data control.

The DBCombo control also supports an automated search mode that can quickly locate items in the list without additional code.

Shown below is a list of the properties used to fill and manage the DBCombo control, and bind the selected data to a Data control.

Property Specifies
DataSource Name of Data control that is updated once a selection is made.
DataField Name of a field that is updated in the Recordset specified by the DataSource property.
RowSource Name of Data control used as a source of items for the list portion of the control.
ListField Name of a field in the Recordset specified by RowSource that is used to fill the drop-down list. DBCombo does not support fields of LongBinary type for the Listfield property.
BoundColumn Name of a Field in the Recordset specified by RowSource to be passed back to the DataField once a selection is made. DBCombo does not support fields of LongBinary type for the BoundColumn.
BoundText Text value of BoundColumn field. Once a selection is made, this value is passed back to update the Recordset object specified by the DataSource and DataField properties.
Text Text value of the selected item in the list.
MatchEntry How the list is searched as the user types in characters at run time.
SelectedItem The bookmark of the selected item in the Recordset specified by the RowSource property.
VisibleCount The number of items visible in the list (fully or partially).
VisibleItems An array of bookmarks with a maximum number of items equal to the VisibleCount property.

Users can search the DBCombo control by typing a value into the text box portion of the control. Once entered, this value is located in the list and the current list item is set to that item. If the item is not found, the BoundText property is set to null.

*Note* If you do not make the boundary of the control large enough for at least one row of the dropdown list, the list will not appear at run time.