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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Filter command bar combo box after it is created (97)

    Author
    Topic
    #376551

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #617468

      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.

      • #617478

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

        • #617670

          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.

          • #626878

            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.

            • #626905

              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.

    Viewing 0 reply threads
    Reply To: Filter command bar combo box after it is created (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: