Results 1 to 8 of 8
  1. #1
    jeffjeff is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    4

    Specific Query

    Hi Guys,

    I am facing a difficulty in creating an access query as I want it to be,

    So, I have a set of data like this

    Manager - Customer

    A _______ Walmart
    A _______ Target
    A _______ Kmart
    B _______ Walmart
    B _______ Target
    B _______Kmart
    C _______Walmart


    C _______Target
    C _______Kmart


    so to summarize, each manager has 3 customers which is the same (Walmart, Target, and Kmart)

    The question is,
    I would like to make a query to exclude

    A - Walmart
    B - Target
    C- Kmart


    I know how to exclude only one of them
    by doing in the query design:


    -------------- Manager --------------------Customer

    Criteria ____<>"A"
    or ___________________________<>"Walmart"

    it works this way,
    however, when I combine all those 3 criterias,
    it doesn't give me the query I want

    Anybody can help me?

    Thanks in advance
    any form of help is much appreciated..

    cheers
    Jeff

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Use this crtieria:
    Code:
    WHERE 
    NOT ((Manager="A") AND (Customer="Walmart")) 
    AND NOT ((Manager="B") AND (Customer="Target")) 
    AND NOT ((Manager="C") AND (Customer="Kmart"));

  3. #3
    jeffjeff is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    4
    Hi Joe, Thanks for the reply,

    So I have to use that criteria in SQL format?
    Thanks

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Just switch your query to SQL View, and replace your WHERE clause with the code that I gave you (assuming those really are your field names).
    If you switch back to Design View, you can see what it looks like it Access Query Builder.

  5. #5
    jeffjeff is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    4
    Quote Originally Posted by JoeM View Post
    Just switch your query to SQL View, and replace your WHERE clause with the code that I gave you (assuming those really are your field names).
    If you switch back to Design View, you can see what it looks like it Access Query Builder.
    Thanks so much Joe for the Help...

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You're welcome!

    I find that sometimes when the criteria gets a little complex, it can be easier to type it directly in SQL View rather than try to figure out how to configure it in Query Builder.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    jeffjeff,

    Sometimes, if you have several combinations you want to exclude, it can be easier to put the exclusions in a separate table.

    Then design the query with the 2 tables, select only the records that are not in the exclusion table.
    See this link

  8. #8
    jeffjeff is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    4
    Quote Originally Posted by orange View Post
    jeffjeff,

    Sometimes, if you have several combinations you want to exclude, it can be easier to put the exclusions in a separate table.

    Then design the query with the 2 tables, select only the records that are not in the exclusion table.
    See this link
    Thanks so much orange,

    I took a look and it's a great idea

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

Similar Threads

  1. Query Out Specific Text
    By ysabella in forum Queries
    Replies: 1
    Last Post: 11-19-2015, 03:53 AM
  2. Replies: 1
    Last Post: 11-20-2014, 08:34 AM
  3. Replies: 1
    Last Post: 06-15-2012, 05:51 PM
  4. Query for specific month
    By bespra in forum Queries
    Replies: 5
    Last Post: 10-22-2011, 07:18 PM
  5. Query-for specific records?
    By sirnickettynox in forum Queries
    Replies: 6
    Last Post: 03-30-2011, 03:11 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