cycling through values in a MS Access list box

Justin picture Justin · May 29, 2010 · Viewed 62.6k times · Source

I have a list box that populates with different sets of data based on user selections.

How can I cycle through any given values that may be in the list box? Is this a For Each statement, or what?

Answer

Robben_Ford_Fan_boy picture Robben_Ford_Fan_boy · May 29, 2010

Here is how you iterate through the ListBox:

Dim i as Integer

For i = 0 to Me.ListBoxName.ListCount -1
   'Access each item with 
   'Me.ListBoxName.ItemData(i)
Next i