Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count records by date

Status
Not open for further replies.

jahlmer

Technical User
Aug 23, 2000
143
US
I am trying to determine the number of records I have where the date field is not more than 60 days old, but not less than 30 days old (last month). I use the following to determine how many within the last 30 days:

=DCount("*","tblNewCalls","[Date] >= Date() - 30 ")


This is in my Control Source for a field on my form.

How can I determine how many records I entered between 30 and 60 days ago?
 
Being an anti fan of the domain aggregate functions "kindly" provided by Ms. A (A.K.A. Big Billy G.), I'm not a good resource for this - as my suggestion is to create a 'real' query for the calcs and simply reference them. In this instance, it would be a simple aggregate query:

Select Count([DateField])
From tblNewCalls
Where [DateField] between Date() And Date() - 30;

Also, it is considered poor practice to use reserved words as field names in your db/tables. "Date" is (obviously) an example here.



MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Hi Michael,

Thank you for the post, and advice about field names. I was looking for a simpler solution besides making queries for each, perhaps using just the count or dcount function to calculate it, as there are 10 fields on my form that require different calculations like this.

Does anyone have an alternate method for this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top