Dcount gives incorrect result

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
 
T

tina

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
 

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