Results 1 to 4 of 4
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486

    Dcount with multiple excludes

    I am trying to use a dcount where the customerid is not 3 or 8 or 9



    I have tried
    =DCount("RailcarID",[AllRailcarData],"CustomerID <> 3 or CustomerID <> 8 or CustomerID <>9")


    =DCount("RailcarID",[AllRailcarData],"CustomerID <> 3 or 8 or 9")

    but neither work

    The customer id filed is a number field

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,477
    use "and" not "or"

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,737
    You can use the Not In() construct as well (a sample from my data)

    Code:
    Dcount("aname","animal","animalId not IN (1,3,4)")

  4. #4
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486
    Thanks guys, I like the not in () way. Also for those who keep making bonehead mistakes like me, you have to have the table name in "" and not in brackets like i do above.

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

Similar Threads

  1. Sort across Multiple Fields DCount help
    By kywilson25 in forum Queries
    Replies: 3
    Last Post: 02-19-2017, 07:29 PM
  2. DCount Multiple Criteria Not Working
    By seantnash in forum Queries
    Replies: 6
    Last Post: 08-19-2016, 02:40 PM
  3. Replies: 3
    Last Post: 06-21-2013, 09:06 AM
  4. DCount with Multiple Criteria
    By Newbie11 in forum Reports
    Replies: 4
    Last Post: 05-25-2012, 09:04 AM
  5. How do you use DCOUNT for multiple criteria?
    By wwhit in forum Programming
    Replies: 5
    Last Post: 05-15-2012, 11:14 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