Discussion Locked

Access 2K - Count function

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Could you please tell me how to count records in a report based on a criteria. I normally set up a text box and type:
=Count([RESULT])
. . .to get the total number of records

I would like something like
= CountIf [RESULT]="Pass"

Many thanks for your helkp in advance

5 replies

by techrep

Use the DCount function to determine the number of records that are in a specified set of records (a domain). For example, you could use the DCount function in a module to return the number of records in an Orders table that correspond to orders placed on a particular date.

Syntax:

DCount(expr, domain[, criteria])

Using your example in a textbox (replace TableName with the appropriate table name):

=Dcount("[RESULT]", "TableName","[RESULT]='Pass'")

by adisha

Poster rated this answer.Thank you for your prompt resoponse , but I really need to be able to DCount on groupings.

by adisha

This is great! But what if I want to use 'GroupBy' where the report has grouped e.g. [SUBJECT] field according to categories?

something like . . .
=DCount("[RESULT]","tblRESULTS","[RESULT]='Pass'")
. . . Groupby [SUBJECT]

is this possible?

Hope this makes sense . . .

This discussion is closed to new replies.