I have a listbox in a Microsoft Access form. The MultiSelect property is set to simple.
I want to know which item in the listbox was clicked. Keep in mind that an item may be clicked to SELECT or UNSELECT an item.
Is there a simple way to do this? If not is there a complicated way to do this?
I tried to use the SendMessage windows API but no banana because Access controls do not support an hwnd property.
Seth
If the MultiSelect proerty is None then just the value of the list box.
Debug.Print Me.List16
should be sufficient.
If you want the values of multiple columns
Debug.Print Me.List16.Column(0) & ", " & Me.List16.Column(1)
If the MultiSelect property is simple or complex then you need to loop through the ItemsSelected collection.
Dim varItm As Variant
For Each varItm In me.ListBx.ItemsSelected
Debug.Print me.ListBox.ItemData(varItm)
Next varItm
Above is air code.