Results 1 to 4 of 4
  1. #1
    ryonker is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    6

    Filter by combo box nightmare

    Hi everyone and thanks for any help. I've searched through the forum for answers and have tried some that i have seen but still cannot get this to work.



    I have a form to display records from one table. I need to be able to filter the records shown on the form by date. I've created a combo box that show the dates from the importDate field in the table and only unique dates. If I select a date from the combo box to filter the records nothing happens. I have the following code in the "afterupdate" of the combo box. The "importDate" is the field in the table that has the dates that the data was imported into the database and is the field that needs to be filtered on.

    Private Sub cboImportDate_AfterUpdate()
    Me.Filter = "importDate = " & Me.cboImportDate.Value
    Me.FilterOn = True
    End Sub

    Any help would be greatly appreciated.

    Thanks,
    Robert

  2. #2
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Date values must be enclosed by # signs. See if the following works:
    Code:
    Me.Filter = "importDate = #" & Me.cboImportDate.Value & "#"
    Do you have the combo box in the header of the form and is the combo box unbound?

  3. #3
    ryonker is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    6
    This worked like a charm. Good to know about the dates needing # before and after and yes the combo box is in the header and is unbound. thank you so much for your help.

  4. #4
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You're welcome. Glad that worked out for you.

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

Similar Threads

  1. filter value in a combo box
    By dada in forum Programming
    Replies: 3
    Last Post: 09-05-2010, 01:22 PM
  2. Combo Box filter – help!
    By catat in forum Forms
    Replies: 1
    Last Post: 08-24-2010, 04:15 PM
  3. Filter my form from combo box
    By Angate in forum Forms
    Replies: 3
    Last Post: 04-24-2010, 01:57 PM
  4. Combo Box Filter
    By jgelpi in forum Programming
    Replies: 3
    Last Post: 07-27-2009, 12:54 PM
  5. Applying a filter to a combo box
    By bugchaser in forum Programming
    Replies: 1
    Last Post: 02-20-2009, 02:37 PM

Tags for this Thread

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