I'm using a button a remove entries in a listbox using this code,
_________________________________________________________________
Private Sub removeCompanyBtn_Click()
For i = 0 To Me.customerQueryList.ListCount - 1
If (Me.customerQueryList.Selected(i)) Then
Me.customerQueryList.RemoveItem i
End If
Next
End Sub
_________________________________________________________________
But what is happening is when I select a entry and press the remove button, it removes the first entry it finds and then the list box deselects all the entries I have selected. It still goes through the loop but because they were all deselected it won't remove them.
Anyone know why it would be deselecting after the first one is removed?
would it be helpful to add my listbox settings?
_________________________________________________________________
Private Sub removeCompanyBtn_Click()
For i = 0 To Me.customerQueryList.ListCount - 1
If (Me.customerQueryList.Selected(i)) Then
Me.customerQueryList.RemoveItem i
End If
Next
End Sub
_________________________________________________________________
But what is happening is when I select a entry and press the remove button, it removes the first entry it finds and then the list box deselects all the entries I have selected. It still goes through the loop but because they were all deselected it won't remove them.
Anyone know why it would be deselecting after the first one is removed?
would it be helpful to add my listbox settings?