# Thread: Counting a Field if it has a Result (2000)

1. ## Counting a Field if it has a Result (2000)

Hi:

I need a querry function to calculate whether a field has a date entered in it or not. We are trying to count all the "replies" we receive and we note the replies by entering the date received in a field called "date confirmed". Now I want to look back at all the records and count all the ones that have replied so far. I tried to do an IF/THEN statement in the querry calculation but I couldn't do it.

Any ideas?
Thanks,
Craig

2. ## Re: Counting a Field if it has a Result (2000)

You can use an expression like this in a totals query:

RepliedCount: Abs(Sum(Not IsNull([Date Confirmed])))

IsNull([DateConfirmed]) is True if Date Confirmed has not been filled in yet, False otherwise.
Not IsNull([DateConfirmed]) is True if Date Confirmed has already been filled in, False otherwise.
In Access, True = -1 and False = 0, so in the Sum function, each filled in date counts as -1, i.e. the Sum function counts minus the number of filled in dates.
The Abs function removes the minus.

3. ## Re: Counting a Field if it has a Result (2000)

I believe this can be done simply by using a totals query, that includes doing a Count on that date field. Count only counts non-null entries.

4. ## Re: Counting a Field if it has a Result (2000)

Yes, that is easier than the solution I proposed.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•