count and specifiying criteria

K

Karen

Hi,

I would like to add some count controls to a report. I can get the
following to work correctly =DCount([id]", "tbl_name", "[status]='agreed'")
but cannot get the following to work: =DCount("[id]",
"tbl_name","[status]='agreed'" and "[prov]='NL'") What am I doing wrong?
 
D

Duane Hookom

NthDegree has provided the appropriate syntax if you wan to reference all
records in the table. Your report might be filtered but this would not be
reflected in the DCount().

If you actually want to count the number of records meeting your criteria in
the report record source, use:

=Sum(Abs([status]="agreed" and [prov]="NL"))

This expression is much more efficient and possibly more accurate than
DCount().

--
Duane Hookom
Microsoft Access MVP


NthDegree said:
Try this:

=DCount("[id]", "tbl_name","[status]='agreed' and [prov]='NL'")

Karen said:
Hi,

I would like to add some count controls to a report. I can get the
following to work correctly =DCount([id]", "tbl_name",
"[status]='agreed'")
but cannot get the following to work: =DCount("[id]",
"tbl_name","[status]='agreed'" and "[prov]='NL'") What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top