Count Records for this week, this month, this quarter and this yea

S

Silvio

Hello, I am using the code--
=DCount("[ClaimID]","tblClaims","DateValue([DateCreated])=Date()") --to count
the number of record created today. I would like to use a similar code to
count the number of record created:
1) This week
2) This Month
3) This Quarter
4) This Year

When I say “thisâ€, I mean the current week, month, Quarter and Year based on
NOW. For example, if I have 5 record for December 2009 and 6 records for
December 2008, since we are in 2009 the total for “This Month†will be 5 (not
5 + 6 = 11). Also, my Record Created date had a date/time value.

Thank you,
Silvio
 
D

Daryl S

Silvo -

Use the DatePart function, and remember to test for both the year and the
month/quarter/week, etc. Here is the code for the quarter:

=DCount("[ClaimID]","tblClaims",(DatePart("yyyy",[DateCreated])=DatePart("yyyy",Date()) AND DatePart("q",[DateCreated])=DatePart("q",Date())))

--
Daryl S


Silvio said:
Oops! Posted in the wrong area sorry.

Silvio said:
Hello, I am using the code--
=DCount("[ClaimID]","tblClaims","DateValue([DateCreated])=Date()") --to count
the number of record created today. I would like to use a similar code to
count the number of record created:
1) This week
2) This Month
3) This Quarter
4) This Year

When I say “thisâ€, I mean the current week, month, Quarter and Year based on
NOW. For example, if I have 5 record for December 2009 and 6 records for
December 2008, since we are in 2009 the total for “This Month†will be 5 (not
5 + 6 = 11). Also, my Record Created date had a date/time value.

Thank you,
Silvio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top