I have a list box in my Access form. I need to know if any of the rows in this list box has been selected by the user. Is there any simple Access property or method exists for this purpose? I do not want to loop through the listbox to check if any row's selected property is true, because I am only interested to know if a selection action is done.
A list box has the ItemsSelected
property which returns a read-only reference to the hidden ItemsSelected
collection. And you can ask for the Count
property of that collection ...
MsgBox Me.YourListBoxName.ItemsSelected.Count & " items selected"