on 2004 Apr 13 2:10 PM
How do you clear all the items out of a combo box in a matrix?
For "normal" comboboxes on a form I've been using the following code:
Set cbo = oForm.Items("cbo").Specific
If (Not cbo Is Nothing) Then
Do While cbo.ValidValues.Count > 0
Call cbo.ValidValues.Remove(0, psk_Index)
Loop
End If
But if I use the same code for a combo box in a matrix I get the following error:
Runtime Error "-10"
Am I missing something? Is there a better way of removing items from a combobox?
Thanks in advance
Hi Simon
An old developer hint is: Delete all items of a list by deleting the last item first, and then stepping back to the top of the list removing the first item last.
Perhaps this old hint solves your problem too? Code could look like this (not tested):
dim i as Long
For i = cbo.ValidValues.Cont-1 To 0 Step -1
cbo.ValidValues.Remove(i, psk_Index)
next i
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.