jmstarbuck
Programmer
I am trying to loop through a listbox to remove all the items before refilling it. I've never done this before and haven't found an example that has helped yet.
Anyway, I try to do it in the code below. The problem is that when I exit the for loop there are still items in the listbox. If I keep forcing it back through the for loop I will eventually delete all the items.
Please let me know if you can see what I am doing wrong..
Anyway, I try to do it in the code below. The problem is that when I exit the for loop there are still items in the listbox. If I keep forcing it back through the for loop I will eventually delete all the items.
Please let me know if you can see what I am doing wrong..
Code:
qualifylistcount = Nz(Forms!Application_Form.LBQualify.ListCount, 0)
If qualifylistcount > 0 Then
For i = 0 To qualifylistcount - 1
j = Forms!Application_Form.LBQualify.ListIndex
Forms!Application_Form.LBQualify.RemoveItem i
Next i
End If
qualifylistcount = Nz(Forms!Application_Form.LBQualify.ListCount, 0)