G
Guest
I am having trouble getting this code to do what I want. I am using the
following code to loop through an unbound list box and do a multi remove.
All it does is remove the first item of the multi-selected items, but I want
all the multi-selected items to be removed. I'd also like to have the list
box reset to have no items when the form is closed or a "clear" button is
clicked.
Private Sub Command5_Click()
Dim ctl As Control
Dim varItem As Variant
Set ctl = Forms!frmLBtest!lbStepIDs
For Each varItem In ctl.ItemsSelected
Me!lbStepIDs.RemoveItem ctl.ItemData(varItem)
Next varItem
Me!lbStepIDs.Requery
End Sub
Thanks in advance.
following code to loop through an unbound list box and do a multi remove.
All it does is remove the first item of the multi-selected items, but I want
all the multi-selected items to be removed. I'd also like to have the list
box reset to have no items when the form is closed or a "clear" button is
clicked.
Private Sub Command5_Click()
Dim ctl As Control
Dim varItem As Variant
Set ctl = Forms!frmLBtest!lbStepIDs
For Each varItem In ctl.ItemsSelected
Me!lbStepIDs.RemoveItem ctl.ItemData(varItem)
Next varItem
Me!lbStepIDs.Requery
End Sub
Thanks in advance.