Skip to Content
avatar image
Former Member

UI: Clearing items from a combobox item in a matrix

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Apr 14, 2004 at 08:32 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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!