By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,661 Members | 1,319 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,661 IT Pros & Developers. It's quick & easy.

need help counting specific dates in query

P: 32
Hello all,

I am having a rather simple problem that for some reason i can not get to work. i have a date field, and i want to simply count all of the current dates(as in today) in that field.

What I have that is not working:

Expand|Select|Wrap|Line Numbers
  1. count([Date Field])=Date() as Date Field
I know i am missing something, I think I read some were to sum it up, but I tried and that didn't work eather. If some one could help me that would be great.
Jul 30 '07 #1
Share this Question
Share on Google+
4 Replies


damonreid
Expert 100+
P: 114
I know you could build a query to filter for a particular date and run a report based on that query.

In the footer make a text box with the following code.

Expand|Select|Wrap|Line Numbers
  1. =Count([SomeFieldThatIsFilledInForAllRecords])
Jul 30 '07 #2

P: 65
Hello all,

I am having a rather simple problem that for some reason i can not get to work. i have a date field, and i want to simply count all of the current dates(as in today) in that field.

What I have that is not working:

count([Date Field])=Date() as Date Field

I know i am missing something, I think I read some were to sum it up, but I tried and that didn't work eather. If some one could help me that would be great.
For counting use COUNT in the record source of the field. So in the Record Source of the field put:
=COUNT([text0])
Jul 30 '07 #3

NeoPa
Expert Mod 15k+
P: 31,271
Again, you've left us very little contextual information to work with. However, as a general concept you can try :
Expand|Select|Wrap|Line Numbers
  1. SELECT ...
  2.        Sum(IIf([Date Field]=Date(),1,0)) AS [TodayCount],
  3.        ...
  4. FROM [YourTable]
Jul 30 '07 #4

P: 32
Again, you've left us very little contextual information to work with. However, as a general concept you can try :
Expand|Select|Wrap|Line Numbers
  1. SELECT ...
  2.        Sum(IIf([Date Field]=Date(),1,0)) AS [TodayCount],
  3.        ...
  4. FROM [YourTable]
Thank you very much that worked perfectly, I had tried a IIF statement like that befor but I had not done it in a while in the SQL and just did IF and didn't want to work. I am also sorry i do not provide so much data, i try just to provide enough to get the information threw, it is easier for me this way since i have to replace the real field names with fake ones.

Thank you again
Jul 30 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.