K
krzysztof via AccessMonster.com
Good afternoon...
I am not seeing my error on this one...this should be easy.
i have a listbox in a form, and i want to clear it. but the total number of
items can change. so i tried this code:
Dim i As Integer
Dim counter As Integer
counter = Me.list_Changed.ListCount - 1
For i = 0 To counter
Me.list_Changed.RemoveItem (i)
i = i + 1
Next
at first i determine how many items there are, then set the loop to run
through that many items.
seems simple enough? i keep getting a error "no item number '8'"
in my example there are 10 items in the list. (0 to 9) for the indexes,
hence the listcount - 1 above.
what am i not seeing?
thanks in advance
I am not seeing my error on this one...this should be easy.
i have a listbox in a form, and i want to clear it. but the total number of
items can change. so i tried this code:
Dim i As Integer
Dim counter As Integer
counter = Me.list_Changed.ListCount - 1
For i = 0 To counter
Me.list_Changed.RemoveItem (i)
i = i + 1
Next
at first i determine how many items there are, then set the loop to run
through that many items.
seems simple enough? i keep getting a error "no item number '8'"
in my example there are 10 items in the list. (0 to 9) for the indexes,
hence the listcount - 1 above.
what am i not seeing?
thanks in advance