count and specifiying criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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?
 
Back
Top