BoundColumn Property

Applies to

ComboBox Object
ListBox Object

When you make a selection from a list box (list box: A control that provides a list of choices. A list box consists of a list and an optional label.) or combo box (combo box: A control used on a form that provides the combined functionality of a list box and a text box. You can type a value in a combo box, or you can click the control to display a list and then select an item from that list.), the BoundColumn property tells Microsoft Office Access 2007 which column's (column: A location within a database table that stores a particular type of data. It is also the visual representation of a field in a datasheet and, in an Access database, the query design grid or the filter design grid.) values to use as the value of the control (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.). If the control is bound (bound control: A control used on a form, report, or data access page to display or modify data from a table, query, or SQL statement. The control's ControlSource property stores the field name to which the control is bound.) to a field (field: An element of a table that contains a specific item of information, such as a last name. A Title field might contain Mr. or Ms. Databases such as Microsoft SQL Server refer to fields as columns.), the value in the column specified by the BoundColumn property is stored in the field named in the ControlSource property. Read/write Long.

expression.BoundColumn

expression Required. An expression that returns one of the objects in the Applies To list.

Setting

The BoundColumn property uses the following settings.

Setting Description
0 The ListIndex property value, rather than the column value, is stored in the current record (current record: The record in a recordset that you can modify or retrieve data from. There is only one current record in a recordset, but a recordset may have no current record, for example, after a record has been deleted from a dynaset-type recordset.). The ListIndex property value of the first row is 0, the second row is 1, and so on. Access sets the ListIndex property when an item is selected from a list box or the list box portion of a combo box. Setting the BoundColumn property to 0 and using the ListIndex property value of the control might be useful if, for example, you are only interested in storing a sequence of numbers.
1 or greater (Default is 1) The value in the specified column becomes the control's value. If the control is bound to a field, then this setting is stored in that field in the current record. The BoundColumn property can't be set to a value larger than the setting of the ColumnCount.

You can set the BoundColumn property by using the control's property sheet (property sheet: A pane that is used to view or modify the properties of various objects such as tables, queries, fields, forms, reports, data access pages, and controls.), a macro (macro: An action or set of actions that you can use to automate tasks.), or Visual Basic for Applications (VBA) (Visual Basic for Applications (VBA): A macro-language version of Microsoft Visual Basic that is used to program Microsoft Windows-based applications and is included with several Microsoft programs.) code.

For table fields, you can set this property on the Lookup tab in the Field Properties section of table Design view (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.) for fields with the DisplayControl property set to Combo Box or List Box.

ShowTip

Access sets the BoundColumn property automatically when you select Lookup Wizard as the data type for a field in table Design view.

In Visual Basic for Applications (VBA) code, set the BoundColumn property by using a number or a numeric expression (numeric expression: Any expression that evaluates to a number. The expression can be any combination of variables, constants, functions, and operators.) equal to a value from 0 to the setting of the ColumnCount property.

Remarks

The leftmost visible column in a combo box (the leftmost column whose setting in the combo box's ColumnWidths property is not 0) contains the data that appears in the text box part of the combo box in Form view (Form view: A view that displays a form to show or accept data. Form view is the primary means of adding and modifying data in tables. You can also change the design of a form in this view.) or in a report (report: An Access database object that you can print, which contains information that is formatted and organized according to your specifications. Examples of reports are sales summaries, phone lists, and mailing labels.). The BoundColumn property determines which column's value in the text box or combo box list will be stored when you make a selection. This allows you to display different data than you store as the value of the control.

 Note   If the bound column is not the same as the leftmost visible column in the control (or if you set the BoundColumn property to 0), the LimitToList property is set to Yes.

Access uses zero-based numbers to refer to columns in the Column property. That is, the first column is referenced by using the expression Column(0); the second column is referenced by using the expression Column(1); and so on. However, the BoundColumn property uses 1-based numbers to refer to the columns. This means that if the BoundColumn property is set to 1, you could access the value stored in that column by using the expression Column(0).

If the AutoExpand property is set to Yes, Access automatically fills in a value in the text box portion of the combo box that matches a value in the combo box list as you type.

 
 
Applies to:
Access 2007