Selecting all records in a list box

  • Thread starter Thread starter JKlein
  • Start date Start date
For i = 1 To Me.lstBookings.ListCount - 1
Me.lstBookings.Selected(i) = True
Next i

note that the selected array is zero based, hence we go less one.

Also, if you have the "show headings" for the list box turned on, then the
first row (0) needs to be ignored.

So, the above code looks a bit strange, since we skip the first row (0), and
we are using a zero based list reference....

If you listbox does not have the headings turned on..then start the above
loop from 0....
 
Back
Top