Analyzing data from a check box using a query

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

I recently created a from in Access 2000 that has several
check boxes in Yes/No format. My desire is to analyze the
data in a query (make all teh checked boxes 1's and all
teh unchecked boxes 0's) in order to create a report that
shows what type and how many of each particular checked
box I have! I have wrote the query and tried using the
count function under sort. This changed the boxes into
numbers but made everything 1's regardless of whether or
not the box was checked!
 
Hi,


Indeed, counting just do that, it count the number of people, it does
not class them accordingly to their vote. You have two alternative, you
group by:

SELECT COUNT(*), value
FROM myTable
GROUP BY value


since value can be 0 (false,unchecked) or -1 (true, checked), you would get
the count associated with each value,


SELECT ABS(SUM(value)) As numberOfYes,
ABS(SUM(NOT value)) As numberOfNo
FROM myTable

would do the same, in just one record. A sum make the summation, since -1 is
true, and false is 0, summing every one return -n, n = the number of true.
Change the Boolean state (NOT value) and you sum the initial false (0) the
same way.


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top