Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Filter command bar combo box after it is created (97)

    Filter command bar combo box after it is created
    Is it possible to apply a filter to a command bar combo box control once it has been created and contains a default set of values that you want to filter further?

  2. #2
    New Lounger
    Join Date
    Nov 2001
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filter command bar combo box after it is created (97)

    You can programatically change the items that appear in a command bar combo box like this. You will need a reference to the Microsoft Office 8.0 Object Library:-

    Public Sub ChangeItems()

    Dim cmdbr As CommandBar
    Dim cbo As CommandBarComboBox

    Set cmdbr = CommandBars("Custom") ' (Put your Commandbar Name in here)
    Set cbo = cmdbr.Controls(1) ' (Control position on Commandbar starting with 1)

    With cbo ' (Add your logic to populate required items)
    .Clear
    .AddItem "First Item", 1
    .AddItem "Second Item", 2
    .DropDownLines = 3
    .DropDownWidth = 75
    .ListIndex = 0
    End With

    End Sub


    Dave.

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filter command bar combo box after it is created (97)

    Thanks Dave but I was looking more along the lines of filtering an existing list further rather than having to create it over anew.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Filter command bar combo box after it is created (97)

    Understand that you can't "filter" the rows in a combo or listbox, on a commandbar or otherwise. You have to repopulate the list in some fashion.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Arkansas, USA
    Posts
    163
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filter command bar combo box after it is created (97)

    Is there a way to repopulate the list box based on the current filter that applies to my form? I use the filter by form method to allow users to select specific records, and want those records that have been filtered for to appear in my list box.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Filter command bar combo box after it is created (97)

    You asked this same question in this thread and received an answer there. Please don't start several threads on the same topic. Those who are more than willing to help can find themselves doing double work and it makes it harder for others with similar questions to find definitive answers. I'm going to lock this thread and ask that any further responses be posted to the other thread.
    Charlotte

Posting Permissions

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