Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo Box Search & Filter (A2K)

    Situation:
    I have a form which through a combination of combo boxes, allows me to select/filter specific records.
    I have a separate combo box which displays all of the records from the source query, not the filtered records.

    Need:
    This combo box to "look" only at the filtered records and allow me to 'click' on that record and go to it in the form.
    Cheers,
    Andy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box Search & Filter (A2K)

    I have attached a demo based on the Categories and Products tables from the Northwind database. The basic idea is to change to row source of the combo box when the form is filtered by one of the other combo boxes. In the demo form, there is a combo box cboSelectCat that filters the form, and a combo box cboSearchProduct that can be used to jump to a record. The After Update event procedure of cboSelectCat looks like this:

    Private Sub cboSelectCat_AfterUpdate()
    If IsNull(Me.cboSelectCat) Then
    Me.Filter = ""
    Me.FilterOn = False
    Me.cboSearchProduct.RowSource = _
    "SELECT ProductID, ProductName FROM Products ORDER BY ProductName"
    Else
    Me.Filter = "CategoryID = " & Me.cboSelectCat
    Me.FilterOn = True
    Me.cboSearchProduct.RowSource = _
    "SELECT ProductID, ProductName FROM Products WHERE CategoryID = " & _
    Me.cboSelectCat & " ORDER BY ProductName"
    End If
    End Sub

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box Search & Filter (A2K)

    Hans,

    Thanks as always,
    Cheers,
    Andy

Posting Permissions

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