Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    46

    Post Unanswered: What am I missing here?

    Maybe I'm losing my mind, but I can't get this to work (should be simple).

    I am getting "Object Required" error when I try to execute the sub "RemoveComboItems" below. This is my code:

    Dim MyCombo As ComboBox
    Set MyCombo = Forms!EnrAppInd!ACOption
    RemoveComboItems (MyCombo)

    Public Sub RemoveComboItems(WCombo As ComboBox)
    With WCombo
    For lListIndex = .ListCount - 1 To 0 Step -1
    .RemoveItem (lListIndex)
    Next lListIndex
    End With
    End Sub

    Thanks in advance!
    Brian

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You forgot to declare lListIndex. Also, remove the paranthesis around MyCombo:

    RemoveComboItems MyCombo

    If you want to clear a combobox, set its rowsource = "".
    Last edited by Teddy; 05-05-06 at 15:21.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    May 2002
    Posts
    46
    Thanks Teddy - it was the parenthesis.

    Have a good weekend!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •