none
DCount and with Date() not working as expected RRS feed

  • Question

  • Hi all-
    I have a form with a text box that includes the following dcount string, to count the number of assignments the person has received in the current month.  Can anyone tell me why it is not working?  I've replaced (below) the real name with "persons name" :

    =DCount("ClaimNumber","NewClaimAssignments","[ExaminerAssigned] = 'persons name' AND DATEPART('y',[DateOfAssignment]) = DATEPART('y',DATE()) AND DATEPART('m',[DateOfAssignment]) = DATEPART('m',DATE())")

    I'm only getting a '0' in the box.

    Thanks!

    Monday, December 7, 2015 4:18 PM

Answers

  • Hi, yes, this is access.
    I found the answer to my question: my year datepart was using bad syntax.  It should've been 'yyyy'.
    • Marked as answer by Casey_M Monday, December 7, 2015 8:43 PM
    Monday, December 7, 2015 8:42 PM

All replies

  • MMm. This is Access? If yes, we can move it to the Access forum for you...

    What is the expected result?

    From my personal (non-professional) experience it sometimes helps to try using the function in a query to track down where the logic error resides...


    Cindy Meister, Office Developer/Word MVP, <a href="http://blogs.msmvps.com/wordmeister"> my blog</a>

    Monday, December 7, 2015 6:13 PM
  • Hi, yes, this is access.
    I found the answer to my question: my year datepart was using bad syntax.  It should've been 'yyyy'.
    • Marked as answer by Casey_M Monday, December 7, 2015 8:43 PM
    Monday, December 7, 2015 8:42 PM