RowSource Property

Example   Applies To   See Also

Specifies the source of the values in a ComboBox or ListBox control. Available at design time and run time.

Syntax

Control.RowSource[ = cName]

Settings

cName

Specifies the source of the values.

Remarks

The source of the values can be a comma-delimited list of values, a table, a SQL statement that creates a cursor or a table, a query, an array, a comma-delimited list of fields (which may be prefaced by a period and the table alias), a file skeleton (such as *.dbf or *.txt), a table's field names, or a menu. Use the RowSourceType property to set the type of row source.

You can use RowSource to specify multiple columns for a ComboBox or ListBox control at design time. To specify multiple columns, set RowSourceType to 1 (Value) and specify the RowSource values (separated by a comma) as follows:

Col1Row1,Col2Row1,Col1Row2,Col2Row2,,Col2Row3

To specify an alias for the table containing the columns, use the following syntax:

Alias.Col1Row1,Col2Row1,Col1Row2,Col2Row2,,Col2Row3

The values you specify fill the control, by row, up to the number of columns that are specified by the ColumnCount property. The preceding example assumes that ColumnCount is set to 2. As shown in the preceding example, there will be no value in column 1, row 3 because there are two successive commas with no value entered between them preceding column 2, row 3.