Strange count of Dcount

  • Thread starter Thread starter Hermie
  • Start date Start date
H

Hermie

Hello

I put this expression in a textbox on my report:
=DCount("[Importancia]","totals2","[importancia] = 'A' ")
The result = 91
But when I go back to my query and do a filter on field that contains the A
I count 98 which is correct. The same in the table it counts 98 for A
When I change function to: =DCount("[Importancia]","totals2","[importancia]
= 'A' or 'a' ") the it counts 98. Table not have lowercase Why do I need to
add the 'a' in the function?
Herman
 
For your second expression to work like you expect, you would need to use
=DCount("[Importancia]","totals2","[importancia] = 'A' or [importancia] =
'a' ")

If you want to count the number of records in your report that have an
importancia value of A, you can use:
=Sum( Abs(importancia ="A") )
You might also want to try
=Sum( Abs(Trim(importancia) ="A") )
 
Hi Duane

Thanx for your advice, it brought me to a simpler design of query and
report.
But the miscount was due to the query which had isnull criterials in the
other fields
Hermie

Duane Hookom said:
For your second expression to work like you expect, you would need to use
=DCount("[Importancia]","totals2","[importancia] = 'A' or [importancia] =
'a' ")

If you want to count the number of records in your report that have an
importancia value of A, you can use:
=Sum( Abs(importancia ="A") )
You might also want to try
=Sum( Abs(Trim(importancia) ="A") )

--
Duane Hookom
MS Access MVP


Hermie said:
Hello

I put this expression in a textbox on my report:
=DCount("[Importancia]","totals2","[importancia] = 'A' ")
The result = 91
But when I go back to my query and do a filter on field that contains the
A
I count 98 which is correct. The same in the table it counts 98 for A
When I change function to:
=DCount("[Importancia]","totals2","[importancia]
= 'A' or 'a' ") the it counts 98. Table not have lowercase Why do I need
to
add the 'a' in the function?
Herman
 
Back
Top