true/false field calculation

G

Guest

Hi

I am trying to perform a calculation in a query (I believe this is the best
place to do it) which gives me the total number of trues in a true/false
field. I have the following:

Sum(Abs([MyTrue/FalseField]))

However, this only seems to work when it is the only column in the query and
no table is specified.

Is there any way that I can perform a query using more than one table on a
true/false field, and then have it total the number of trues?
 
D

Duane Hookom

Sum() is an aggregate used in a totals query. I normally use an expression
like you provided as a control source of a text box in a report Report or
Group Footer (or Header). If you want a count of the number of trues in a
table, use
SELECT Count(*) as NumOfTrues
FROM tblYourTable
WHERE [MyTrue/FalseField] = True;
 
P

Per Larsen

Guess you have to use 'GROUP BY' on the columns (fields) not involved in aggregate functions, like:

SELECT col1, col2, Sum(col3)
FROM MyTable
GROUP BY col1, col2

Hth
PerL
 

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

Similar Threads


Top