Hi everybody,
I'm trying to make a selection(?) query that counts how many "true"(or "Yes") are in several "Yes/No" fields. I've read something about a "dcount" function but I didn't completely get how to use it in the SQL code of the query. Could you please help me? Other solutions?
Many thanks

You include nothing of what you're working with so this must be very general.

Use Sum() and either tot up the times it's yes using IIf(), or simply negate the sum of the values on the understanding that the numerical equivalent of Yes is -1 :

Matteo, what you posted is not what I suggested. You are using Count() for the Yes/No fields (which won't work of course). You are now introducing the fact that you are working within SQL, which your question didn't mention. For performance reasons in SQL, I would try the second suggestion.

Your line #2 would look like :

Expand|Select|Wrap|Line Numbers

-Sum(Estrazione_mese.Trasporto) AS ConteggioDiTrasporto,

Thank you very much, it works, could you explain to me the "passages" of the calculation?
Without the "minus" it should give me something like: (-1) + (-1) + (-1) = -3
but it didn't, it gave me just another true or false.

What does -sum() mean?

Thank you so much, very kind as always
have a nice day

Sweeda:
Without the "minus" it should give me something like: (-1) + (-1) + (-1) = -3
but it didn't, it gave me just another true or false.

I can't see what you describe, but your understanding of the calculation is perfect. The answer would be -3. If the field it's displayed in is configured to format that value as True/False or Yes/No, then that is another matter. It is only the format though, not the value. You were absolutely right in your expectation.

Sweeda:
What does -sum() mean?

Return a value that is the negated equivalent of the Sum() value. In your example Sum() = -3 therefore -Sum() = 3.