Results 1 to 6 of 6
  1. #1
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185

    VBA Filter not working with Multiple criteria

    Hi!


    I am having an issue with using two different criteria to filter a form and am asking for some assistance!

    The Part Type Def data type is short text and that part of the code works fine.
    When I added in the Workorder_ID, which is a numeric data type, I am getting a mismatch error.
    Any thoughts on what I'm missing? I've searched and searched and can not find a solution that works. Any help is greatly appreciated! Thank you!


    Private Sub PART_TYPE_DEF_DblClick(Cancel As Integer)
    Me.Filter = "PART_TYPE_DEF Like '*" & Me.PART_TYPE_DEF & "*'" And WorkOrder_ID = "& Me.WorkOrder_ID"
    Me.FilterOn = True




    End Sub

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Double quotes are not correct

    Me.Filter = "PART_TYPE_DEF Like '*" & Me.PART_TYPE_DEF & "*' And WorkOrder_ID = " & Me.WorkOrder_ID

  3. #3
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    I had tried this. I'm getting a runtime error 3709 "The Search Key was not found in any record"

    I just tried again, in case I did a typo, and copy and pasted and am getting the same error. It's a head scratcher!

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    You haven't gone and done what this person did, have you?

    https://www.access-programmers.co.uk...record.327867/
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    LOL!
    I did NOT make that same error! :P

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I did NOT make that same error!
    suggest show the sql to your form recordsource to verify that

    given your propensity for the use of the underscore, perhaps WorkOrder_ID should be Work_Order_ID?

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

Similar Threads

  1. Replies: 9
    Last Post: 06-26-2021, 03:56 AM
  2. DCount Multiple Criteria Not Working
    By seantnash in forum Queries
    Replies: 6
    Last Post: 08-19-2016, 02:40 PM
  3. Multiple Criteria in query not working
    By avarusbrightfyre in forum Queries
    Replies: 3
    Last Post: 04-17-2012, 05:06 PM
  4. Replies: 9
    Last Post: 05-05-2011, 02:05 PM
  5. Replies: 3
    Last Post: 10-13-2010, 03:35 PM

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