Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access VBA loop through Multi Select ListBox

Hi

What Access VBA code would I use to loop through the selected items in the following ListBox and get the values for Manufacturer and Country?

User generated image
Avatar of Norie
Norie

You can use the ItemsSelected property to return a collection of the indices of the selected rows.

You can loop through that collection like this.
Dim idx As Variant

    For Each idx In Me!ListBox1.ItemsSelected
        ' do stuff with selected rows 
    Next idx

Open in new window

Within the loop you can use the Column/ItemData properties to access the actual data.
Avatar of Murray Brown

ASKER

Thanks. How do I refer to a specific field like Manfacturer in that loop?
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks very much for the help