Solved

How to sum true or yes check boxes in a query?

Posted on 2015-01-31
5
143 Views
Last Modified: 2015-02-09
I have a simple query named: "Flow_Chart_1_Qry" that uses the followin tables
TABLES
1-Incident-tbl
2-Events-tbl
3_Conditions_tbl

Many fields in the query are check box field.

One of the check box fields in the 2-Events-tbl is:
 1-Human Engineering

I want to simply total the number of "TRUE" check boxes for the field:  1-Human Engineering
FlowChartOneTEST-DB.accdb
0
Comment
Question by:cssc1
5 Comments
 
LVL 33

Accepted Solution

by:
Mike Eghtebas earned 167 total points
ID: 40581785
Select Sum(IIF(CheckBox1 = True), 1, 0) AS Checked1 ...
From Table1 ...
Group By ...   if applicable

or just

Select Sum(IIF(CheckBox1), 1, 0) AS Checked1 ...
From Table1 ...
Group By ...   if applicable
0
 

Author Comment

by:cssc1
ID: 40581799
Where do I put this code? In the control source?
0
 
LVL 35

Assisted Solution

by:PatHartman
PatHartman earned 167 total points
ID: 40581807
If you want to just sum the true values then, use this as the ControlSource in the group or report footer.

= Abs(Sum(TheCheckFieldName))

If you want separate sums for true and false, then you need two controls
The first one to count the true

= Sum(IIf(TheCheckFieldName = True, 0, 1))  ''''' this counts both false and null as false.

OR

= Sum(IIf(TheCheckFieldName = False, 1, 0)  '''' this counts only the false values
0
 
LVL 10

Assisted Solution

by:Luke Chung
Luke Chung earned 166 total points
ID: 40584511
You can add it as a calculated field in your query.

It's mentioned in my Query Tips and Techniques paper: http://fmsinc.com/MicrosoftAccess/query/index.html#Functions
0
 

Author Closing Comment

by:cssc1
ID: 40599525
Thanks
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question