Results 1 to 5 of 5
  1. #1
    lawdy is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jan 2013
    Posts
    172

    Query using 2 'nots'


    I can't get the following query to work anyway I try it.

    What am I doing wrong?

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    What query?
    Nothing attached?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    lawdy is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jan 2013
    Posts
    172
    I pasted an example that did no show up. the code is:
    SELECT tblItemCostRate.fDblItemOrder, tblItemCostRate.fTxtItemMaterial
    FROM tblItemCostRate
    WHERE ((Not (tblItemCostRate.fTxtItemMaterial)="firelane ATredPaint")) OR ((Not (tblItemCostRate.fTxtItemMaterial)="firelane ATgraPaint"));

    Maybe this will do it.

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    It is a logic issue.

    Your Query will always give you all the data from the table, as fTxtItemMaterial will always be either NOT firelane ATredPaint OR NOT firelane ATgraPain

    I think you need an AND

    NOT firelane ATredPaint AND NOT firelane ATgraPain
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    You also don’t need the ‘not’, just change the = to <>

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

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