Counting Yes/No Records

CutAndPaste

Registered User.
Local time
Today, 07:40
Joined
Jul 16, 2001
Messages
60
I'm trying to count the number of records in a query, I've got two fields to compare: gender and a yes/no field.

In other NONE Yes/No Fields calculation I'm using
=(DCount("*","qryName","[Gender]=1 And [OtherFieldValue] = 1"))
and this returns the number of records with the Gender Value of 1 and the Field value of 1 in my [OtherField].

However, some of my [OtherFields] are Yes/No fields and I want to count how many of these are yes for a given value. I'm trying to use

=(DCount("*","qryName","[Gender]=1 And [YesNoField1] = '-1'"))
OR
=(DCount("*","qryName","[Gender]=1 And [YesNoField1] = -1"))

but these give me an #Error message. What am I doing wrong, and can I count Yes/No fields in this way?


tx
 
Thanks Sohaila,

But, I need to calculate the total Yeses (Trues) for Gender = 1 (Male) and also Gender = 2 (female) for each of the check boxes.

tx Simon
 
Well can't you make two sum boxes, one for Male and one for Female? Pardon me if I'm missing the question...
 
So you want to, for example, find out (1) how many people checked yes for BOTH male AND blue eyes, and separately find out (2) how many checked yes for BOTH female AND blue eyes. Is that it? Do you want to see those numbers separately or as a total--how many people checked ((EITHER male OR female) AND (blue eyes)) ?

--Slightly-Puzzled Mac
 
OK, I have a number of Clients (Male and Feamle) who can answer Yes or No to a number of questions each time they visit.

For example:
Do you like apples Y/N
Do you like pears Y/N
Do you like plums Y/N

I want to add up the total females who like apples, the total males that like apples,
the total females who like pears, the total males that like pears, the total females who like plums, the total males that like plums.

I want a seprearate total for males and for females. sorry if I didn't explain very well, sometimes you can't see the wood for the trees!

tx,
Simon
 
Ok, if you want to see this info broken down on a report, I'd suggest grouping by gender then grouping by Yes/No. Keep a running sum in a hidden textbox on the detail section, then show the sum in a visible textbox on the group footer for each grouping.

This will obviate the need for any queries.

If you want to do more than just output the info, tell us more about your table structures.

--Grouping Mac
 

Users who are viewing this thread

Back
Top Bottom