Results 1 to 4 of 4
  1. #1
    labratKY is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    2

    Query multiple fields for the same criteria

    Greetings,



    I'm using Access 2010 and am trying to find records whose fields match a list. The below where statement works. My problem is there can be up to 19 TESTs within each record (TEST0, TEST1, TEST2,..TEST19) any one of which may match something in my list. It's possible only TEST19 may match and I need the search to continue until all TESTn's present are looked at.

    WHERE (((SCCODBC_ORDERS.COLLECT_DATE)>#8/3/2014#) AND ((SCCODBC_ORDERS.TEST0) In ("LUAN2","MPSS","PRELE")));

    Could anyone point me in the right direction?

    TIA!
    John

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Well, the right direction would be to correct the design of the database (normalize it). If you're stuck with it (note the important parentheses):

    WHERE SCCODBC_ORDERS.COLLECT_DATE>#8/3/2014# AND (SCCODBC_ORDERS.TEST0 In ("LUAN2","MPSS","PRELE") OR SCCODBC_ORDERS.TEST1 In ("LUAN2","MPSS","PRELE") OR ...)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    labratKY is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    2

    Thumbs up

    Thanks Paul! That worked. I was in the ball park, my syntax was off just a bit. This is a clinical lab system so I'm afraid the database is pretty much etched in stone by the LIS vendor. Thanks again.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 02-19-2014, 05:49 PM
  2. Calculated fields with multiple criteria
    By Meunderwood in forum Access
    Replies: 1
    Last Post: 08-02-2013, 08:54 AM
  3. Replies: 5
    Last Post: 08-07-2012, 10:12 PM
  4. Multiple Fields in Criteria - String
    By alsoto in forum Forms
    Replies: 3
    Last Post: 08-24-2011, 12:23 PM
  5. FindFirst with multiple fields in criteria
    By compooper in forum Programming
    Replies: 5
    Last Post: 07-22-2011, 10:29 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