View Full Version : Count records that meet criteria


Dimples
08-22-2005, 11:45 AM
I want to put a box on a report that will display the items that are 30 over due. For instance the date of the item is stored in a table in a field called [DateofRecord]. so I want to count the records that a query for a report returns if the [DateofRecord]+30 > today AND if [Status]="In Progress".

What is wrong with this statement:
=Sum(IIf([Status]="In Progress" AND ([DateofRecord]+30)>Today,1,0))


TIA

Rich
08-22-2005, 12:04 PM
=Sum(IIf([Status]="In Progress" AND ([DateofRecord]+30)>Today,1,0))
I don't think Today's a valid identifier try
=Sum(IIf([Status]="In Progress" AND ([DateofRecord]+30)>Date,1,0))

Dimples
08-22-2005, 12:25 PM
Ok, that didnt work. :eek:

it is telling me the expression is either incorrect or too complex. Any ideas?

TIA!

Bhaughbb
08-22-2005, 12:52 PM
Date() is the correct format to return today's date in a query, you can also use Now() which returns not only today's date but also the exact time the query is executed.

That should do it for you, otherwise you need to get into a slightly more complex method of adding 30 days to the date you are testing. where you would use DateAdd("d",30,[DateofRecord]) to add 30 days.