Results 1 to 4 of 4
  1. #1
    DMetcalfe is offline Novice
    Windows XP Access 2002
    Join Date
    Aug 2010
    Posts
    8

    Using "Not Like" in a query

    Hi,



    I wish to restrict a query by not showing entries for a list of people who have left the company

    In the "name" field on my Query, If i put "Like [Leavers]![Leavers]" It will restrict the query to ONLY the people who have left. I wish to reverse this and show everyone apart from the people who have left

    I thought a simple "Not Like [Leavers]![Leavers]" would work, but it doesnt.
    I've also tried "Not [Leavers]![Leavers]", which still gives me no luck.

    Please help me?
    Thanks

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    this would work:
    Code:
    WHERE FIELD NOT IN (
    
    SELECT FIELD FROM TABLE WHERE
    
    FIELD LIKE LEAVERS!LEAVERS)

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Try the unmatched query wizard. On large data sets the join method will be more efficient than a subquery.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Thanks Paul

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

Similar Threads

  1. Replies: 6
    Last Post: 07-25-2012, 06:42 AM
  2. Replies: 3
    Last Post: 04-10-2010, 10:22 AM
  3. aSTR = Dir("C:\*.*") >> "Type Mismatch"
    By JGrant in forum Programming
    Replies: 1
    Last Post: 03-28-2009, 05:17 AM
  4. Replies: 2
    Last Post: 08-31-2006, 12:19 PM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 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