Dcount gives incorrect result

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

Guest

I have a Sum query based on the "Cycle Info" table.
I am comparing the number of cycles in which embryos
were transferred during the first quarters of 2004 and 2005.
The records are grouped by year and quarter. I used the
following two ways to count the number of records in which
the TrfNo>0 during these quarters.

TrfsD: DCount("TrfNo","Cycle Info","[TrfNo]>0")
Trfs: Sum(IIf([TrfNo]>0,1,0))

In both cases in the Total row of the query I chose Expression. The
DCount function gives the same (incorrect) result for both quarters. Please
tell me why.
With thanks,
Andras
 
the Sum() function is working with the dynaset returned by the query,
governed by the criteria and grouping stipulated in the query. the DCount()
function is an aggregate function that is working with all the records from
table CycleInfo, as filtered by the criteria [TrfNo]>0; it is not affected
by any criteria or grouping within the query.

hth
 
Back
Top