ItemData Property [Access 2003 VBA Language Reference]
The ItemData property returns the data in the bound column for the specified row in a combo box or list box. Read-only Variant.
expression Required. An expression that returns one of the objects in the Applies To list.
Index Required Long. The row in the combo box or list box containing the data you want to return. Rows in combo 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.
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. You can 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 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.
The following example prints the value of the bound column for each selected row in a list box EmployeeList on an Employees form. The list box's MultiSelect property must be set to Simple or Extended.
Sub RowsSelected() Dim ctlList As Control, varItem As Variant ' Return Control object variable pointing to list box. Set ctlList = Forms!Employees!EmployeeList ' Enumerate through selected items. For Each varItem in ctlList.ItemsSelected ' Print value of bound column. Debug.Print ctlList.ItemData(varItem) Next varItem End Sub