Results 1 to 5 of 5
  1. #1
    survivo01 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    71

    query two field using or

    I have two fields Monday and Wednesday
    If I query using yes for the Monday field it gives me the classes enrolled on Monday. Now if I query for Wednesday using Yes I end up with Mondays and Wednesday that both have yes. However I want to see the records where Monday might have a yes and wednesday will have a no or Monday with have a no and Wednesday will have a yes.

  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,652
    In design view, put the criteria on different lines. In SQL that creates an "OR" instead of "AND".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    It is difficult to filter records with criteria based on dynamic combinations of multiple Yes/No fields. Because each record is either true or false for each field, using the criteria you describe ((Monday = Yes And Wednesday = No) OR (Monday=No And Wednesday=Yes)) will always return all records. Triple state (Yes/No/Null) might help but I have never used that. I avoid Yes/No fields whenever possible.

    Unless this is what you really meant: Monday=Yes Or Wednesday=Yes. That will exclude all records where both fields are No.

    Multiple similar Yes/No fields often indicates a non-normalized data structure. A better design might be one text field with 3 options (M, W, B)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    survivo01 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    71
    I tried that but it gave me duplicat records. One for Monday and one for tuesday.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Tuesday? When did Tuesday come into this? Why would there be 'duplicate' records? This data structure does not seem normalized and because of that will be very problematic. Provide sample of source data and expected output. If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 4
    Last Post: 07-28-2013, 12:40 AM
  2. Replies: 6
    Last Post: 04-26-2013, 10:07 AM
  3. Replies: 5
    Last Post: 04-23-2013, 01:42 PM
  4. Replies: 5
    Last Post: 06-19-2012, 10:46 AM
  5. Replies: 1
    Last Post: 08-31-2011, 04:03 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