Question : Access ListBox select multiple items

Hi

In Access I have a ListBox with items in it. How do I ensure that the user can select multiple items and
what VBA code would I use to list the selected items.
Thanks

Answer : Access ListBox select multiple items

This code in a command button click event shows how to manipulate a multiselected items in a listbox.

ListBox: List1/properties/other/multiselect: Simple or Extended(using ctrl-click to select more items)

Private Sub cmdList_Click()
    Dim i As Integer
    Debug.Print List1.ItemsSelected.Count
    For i = 0 To List1.ItemsSelected.Count - 1
        Debug.Print List1.ItemsSelected(i) ' index of selected item
        Debug.Print List1.ItemData(List1.ItemsSelected(i)) ' value of item selected
    Next
End Sub
Random Solutions  
 
programming4us programming4us