Control.ItemData property (Access)

The ItemData property returns the data in the bound column for the specified row in a combo box or list box. Read-only Variant.

Syntax

expression.ItemData (Index)

expression A variable that represents a Control object.

Parameters

Name Required/Optional Data type Description
Index Required Long The row in the combo box or list box containing the data that you want to return. Rows in combo boxes and list boxes are indexed starting with zero. For example, to return the item in the sixth row of a combo box, you'd specify 5 for the rowindex argument.

Remarks

The ItemData property enables you to iterate through the list of entries in a combo box or list box. For example, suppose you wanted to iterate through all of the items in a list box to search for a particular entry. Use the ListCount property to determine the number of rows in the list box, and then use the ItemData property to return the data for the bound column in each row.

You can also use the ItemData property to return data only from selected rows in a list box. You can iterate through the ItemsSelected collection to determine which row or rows in the list box have been selected, and then use the ItemData property to return the data in those rows. You must set the MultiSelect property of the list box to Simple or Extended to enable the user to select more than one row at a time.

Use the Column property to return data from a specified row and column, even if the specified column isn't the bound column.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.