Dcount vs expression

H

hermie

In my query I created an dcount and an expression
Now I have difference in quantity

totals test Pueblo Actividad StartDate Importantcia expr1
Hormigueros 2 05-May-2004 11 11
Hormigueros 2 06-May-2004 12 12
Hormigueros 2 07-May-2004 16 14
Hormigueros 2 10-May-2004 10 8
Hormigueros 2 11-May-2004 13 12
Hormigueros 2 12-May-2004 7 7
Hormigueros 2 13-May-2004 12 11
Hormigueros 2 17-May-2004 13 12
Hormigueros 2 18-May-2004 12 11


SQL view
SELECT actividad.Pueblo, actividad.Actividad, actividad.StartDate,
Count(DCount("startdate ","actividad","[importancia] = 'A' ")) AS
Importantcia, Sum(IIf([importancia]="A",1,0)) AS expr1
FROM actividad
GROUP BY actividad.Pueblo, actividad.Actividad, actividad.StartDate
HAVING (((actividad.Pueblo)="HORMIGUEROS"));


The DCount also counts the "B " ??

What causes the difference?

Herman
 
T

Ted Allen

Hi Hermie,

I think that the problem is likely that you are counting
the results of your DCount() expression. Change the
DCount() type to expression (in query builder), or just
remove the Count() function from around it in the sql
view. DCount() will return the count for you, there is
no need to Count() the results of DCount().

HTH, Ted Allen
 

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