T
Tina Marie
Hi .. I want to do a count on a field that is a combo box value list ... yes
or no ... count up the 'yes''s?? Any suggestions
or no ... count up the 'yes''s?? Any suggestions
Arvin Meyer MVP said:Assuming the yes or no is being saved to a table, open a query and add the
field, no change the query to an aggregate query (Totals query, use the
Sigma button) and change Group By to Sum. Since Yes is -1, the total number
of yes's will be the positive of whatever the result is.
Tina Marie said:Hi Arvin ... its not a field type yes/no ... its a combo box drop down
with
value list choices 'yes'/'no' ... they wanted the words, not the
checkmarks
... so count will not work (counts everything) ... going to try the
abs(sum)
function .. let me know if you know another way ...
Douglas J. Steele said:Recognize that how something's displayed to the user should not dictate
what's stored. It's not very difficult to show them Yes or No, but store -1
and 0 in the table.
If Arvin's suggestion doesn't work, you can use:
SELECT Count(*)
FROM MyTable
WHERE MyField = "Yes"
or
SELECT Sum(IIf([MyField] = "Yes", 1, 0))
FROM MyTable
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
Tina Marie said:Hi Arvin ... its not a field type yes/no ... its a combo box drop down
with
value list choices 'yes'/'no' ... they wanted the words, not the
checkmarks
... so count will not work (counts everything) ... going to try the
abs(sum)
function .. let me know if you know another way ...