Results 1 to 2 of 2
  1. #1
    bugchaser is offline Novice
    Windows Vista Access 2003
    Join Date
    Feb 2009
    Location
    Sydney
    Posts
    4

    Applying a filter to a combo box

    Hi Everyone.



    I have a combo box which navigates to a selected record. Works fine.

    What I would like to do is when I apply a filter to the main form the combo box is on, I would like to apply the same filter to the list of records displayed by the combo box.

    I have tried many different approaches, but its beyond me so I thought Id better ask the experts.

    Here is the usual after update code for the combo box:

    Private Sub Combo234_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object
    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Specimen Number] = " & Str(Nz(Me![Combo234], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub

    Any help will be very much appreciated.

    Thanks and cheers.

    Joe.

  2. #2
    Join Date
    Feb 2009
    Posts
    14
    I think all that you need to do is tell the combo to ReQuery. This assumes that the combo's source is based on the filtered form data.

    This would be in the code section that performs the filtering of the form.

    ' Clear the combo
    Me.ComboXXXXX = Null

    ' If the combo RowSource (SQL) needs to change, do it here
    strSQL = ????
    Me.ComboXXXXX.RowSource = strSQL

    ' Force a re-query
    Me.ComboXXXXX.Requery

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Form Based Query/Filter
    By Micon in forum Access
    Replies: 0
    Last Post: 11-07-2008, 09:25 AM
  2. Replies: 0
    Last Post: 08-17-2008, 12:19 PM
  3. Open a table in a From based on a filter
    By turbobeagle in forum Forms
    Replies: 1
    Last Post: 01-11-2008, 12:27 PM
  4. Newbie filter question
    By benplace in forum Access
    Replies: 1
    Last Post: 12-03-2005, 08:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums