Hello Everyone,
I am trying to keep a running total of the number of items selected in a multiselect list box. I want to do this in vb code and update the number dynamically everytime they select or deselect an item in the list. This number will be displayed in a textbox or a label on a form so the user knows how many things they have selected at any time.
Is this possible?
Thanks to everyone!
Hi Schmidt
Yep its dead easy try this
[code]
Private Sub List0_AfterUpdate()
For loop1 = 0 To Me.List0.ListCount
If Me.List0.Selected(loop1) = True Then vCounter = vCounter + 1
Next loop1
Me.Text2 = vCounter
End Sub
List0 is my list box, Text2 is the name of my text box.
You can also use this function by changing the If statement to:
Me.List0.Selected(loop1) = True
If you add this as an After update subroutine to a check box it will select all the rows in your list box (False = Unselect).
Daz