cancel
Showing results for 
Search instead for 
Did you mean: 

UI: Clearing items from a combobox item in a matrix

Former Member
0 Kudos
120

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Cheers for the help but it doesn't make any difference. We've been in contact with SAP about it and apparently it's a known problem fixed in SP1 for 6.5.

Thanks anyway!