When you use a wizard to create a list box or combo box, Microsoft Access sets certain properties for the control. You can work with these properties directly if you don't want to use a wizard to create the control, or you can use a wizard to create the control and then modify these properties to make the control work just the way you want. To find out more about any of the following properties, click the property in the property sheet and press F1.
In an Access database, or in an Access project connected to Microsoft SQL Server 2000 or Microsoft SQL Server 2000 Desktop Engine, you can also use these properties to customize a Lookup field.
Property | Description |
---|---|
RowSourceType | Works together with the RowSource property. You use this property to specify the type of row source (Table/Query, Table/View/StoredProc, Value List, Field List, or Visual Basic function), and then you specify the actual row source in the RowSource property. |
RowSource | Specifies the name of the table, query, or SQL statement if RowSourceType is set to Table/Query. Specifies the entries in the list, separated by semicolons, if RowSourceType is set to Value List. Specifies the name of the table or query if RowSourceType is set to Field List. Is blank if RowSourceType is set to a function name. |
BoundColumn | In a bound multiple-column list box or combo box, specifies which column is bound to the underlying field specified in the ControlSource property. Data in that column will be stored in the field when you select that item in the list. This data may be different from the data that appears in the list if you hide the column. |
ColumnCount | Specifies the number of columns in a list box or combo box. You can include a column but not display it in a list by setting the ColumnWidths property to 0. You might want to do this if you have a list that looks up values from a table or query. You could include an ID field but hide it in the list. In a combo box, the first visible column in the list appears in the text box portion of the combo box. |
ColumnWidths | Specifies the width of each column, separated by semicolons. Enter 0 to hide a column. Enter a semicolon without a measurement to use the default (about 1 in. or 2.5 cm, depending on the unit of measurement set in Windows Control Panel). In a combo box, the first visible column appears in the text box portion of the control. The data type of any value you type in the combo box must be the same as or compatible with the data type of the first visible column. |
ColumnHeads | Determines whether the list box or combo box has column headings. If the combo box or list box is based on a record source, Access uses the field or column names from the record source as the column headings. If the combo box or list box is based on a fixed value list, Access uses the first x items of data from the value list (RowSource property) as the column headings, where x = the number set in the ColumnCount property. Headings appear in combo boxes only when the list is dropped down. |
ListWidth | Specifies the width of the list box portion of a combo box. |
ListRows | Specifies the maximum number of rows to display in the list box portion of a combo box. |
LimitToList | Determines whether a combo box accepts any entered text or only text that matches one of the values in the list. If you want to allow a new value that a user enters to be added to the list, set the property to No and attach an event procedure to the OnNotInList property. |
OnNotInList | Runs the attached event procedure when the NotInList event occurs. You can use this property to automatically add a new value to a list. This property isn't available on the Lookup tab in table Design view. |
AutoExpand | Specifies whether Access automatically fills in a value that matches the characters that you type in a combo box. This property isn't available on the Lookup tab in table Design view |
DisplayControl | Specifies the type of control (combo box or list box) that Access creates by default when you add a Lookup field to a form. This property is available only on the Lookup tab in table Design view. |
Properties you can use to create or modify a list box or a drop-down list box in a data access page
When you use a wizard to create a list box or a drop-down list box in a data access page, Access sets certain properties for the control. You can work with these properties directly if you don't want to use a wizard to create the control, or you can use a wizard to create the control and then modify these properties to make the control work just the way you want. To find out more about any of the following properties, click the property in the property sheet and press F1.
Property | Description |
---|---|
ListRowSource | The name of a record set in the data source that supplies the values and text for the list box or drop-down list box. |
ListBoundField | In a bound list box or drop-down list box, specifies which field is bound to the underlying data source specified in the ListRowSource property. Data in that column will be stored in the field when you select that item in the list. |
ListDisplayField | In a bound list box or drop-down list box, specifies the name of a field in the ListRowSource that provides the display values that correspond to the ListBoundField values. |