Dcount Help. Returns a 0

K

K

Hello.

I am trying to count the number of A's in a report

ElementClass is my field contining the letters.

=DCount("[Elementclass]","tbl_ElementClass","[ElementClass] = 'A' ")

It keeps returning a 0 when there are 2 A's n the particular report.

Any help would be appreciated.

Thanks
 
K

K

Forgot to add. My information in the report is generated from a qry called
"ALL" so I can filter using a parameter. I tried "ALL" in place of
tbl_ElementClass and recieved an #ERROR message.
 
D

Duane Hookom

You should avoid using D...() functions in the report. Try add a text box to
the Report or Group Header or Footer section with a control source like:

=Sum(Abs([ElementClass] ="A"))
 
K

K

Thank you very much. It works!. What is sum ABS mean?

Duane Hookom said:
You should avoid using D...() functions in the report. Try add a text box to
the Report or Group Header or Footer section with a control source like:

=Sum(Abs([ElementClass] ="A"))

--
Duane Hookom
MS Access MVP
--

K said:
Hello.

I am trying to count the number of A's in a report

ElementClass is my field contining the letters.

=DCount("[Elementclass]","tbl_ElementClass","[ElementClass] = 'A' ")

It keeps returning a 0 when there are 2 A's n the particular report.

Any help would be appreciated.

Thanks
 
D

Duane Hookom

Abs() returns the absolute value of an expression. If the expression is a
true/false statement, the value is -1 or 0. The Abs(-1) = 1. Therefore, you
can Sum(1) to get the "count" of records where the expression is true.

--
Duane Hookom
MS Access MVP
--

K said:
Thank you very much. It works!. What is sum ABS mean?

Duane Hookom said:
You should avoid using D...() functions in the report. Try add a text box
to
the Report or Group Header or Footer section with a control source like:

=Sum(Abs([ElementClass] ="A"))

--
Duane Hookom
MS Access MVP
--

K said:
Hello.

I am trying to count the number of A's in a report

ElementClass is my field contining the letters.

=DCount("[Elementclass]","tbl_ElementClass","[ElementClass] = 'A' ")

It keeps returning a 0 when there are 2 A's n the particular report.

Any help would be appreciated.

Thanks
 
Top