Results 1 to 6 of 6
  1. #1
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104

    DCount converse criteria

    Hi all,

    Happily using DCount to extract the answers where there is data/text in the field "Status":
    =DCount("*","TblTmpEventDates","status = 'CANCELLED'")

    But, how do I manage to count the Events in that table where the status is blank? I have tried:
    =DCount("*","TblTmpEventDates","status = ''") I.e.two apostrophes, but to no avail.

    Does anyone know how to count where there are blanks?

    thanks in anticipation
    Pete

  2. #2
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104
    Workaround, created a temporary table with all records that had IsNull("Status") situation, and then just did a DCount on the number of records in the table

    Solved

  3. #3
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    or use the nz function


    =DCount("*","TblTmpEventDates","nz(status,"") = ''")

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Quote Originally Posted by Ajax View Post
    or use the nz function


    =DCount("*","TblTmpEventDates","nz(status,"") = ''")
    Since they are inside a string, you can't use the double quotes in the Nz() function. I think it would need to be:

    Code:
    =DCount("*","TblTmpEventDates","nz(status,'') = ''")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    well spotted!

  6. #6
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104
    well spotted indeed. Thanks both for your input, it works fine now without the need for the extra temporary table

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

Similar Threads

  1. Using DCount, how to use a variable as the criteria
    By crowegreg in forum Programming
    Replies: 2
    Last Post: 02-17-2015, 05:18 PM
  2. Dcount for 2 criteria date fields
    By rmd62163 in forum Access
    Replies: 4
    Last Post: 04-22-2014, 09:51 AM
  3. DCount with Multiple Criteria
    By Newbie11 in forum Reports
    Replies: 4
    Last Post: 05-25-2012, 09:04 AM
  4. How do you use DCOUNT for multiple criteria?
    By wwhit in forum Programming
    Replies: 5
    Last Post: 05-15-2012, 11:14 AM
  5. Mask for dcount criteria
    By akbigcat86 in forum Programming
    Replies: 3
    Last Post: 08-09-2010, 11:00 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