Solved

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

Posted on 2015-01-31
147 Views
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
Question by:cssc1
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 34

Accepted Solution

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

ID: 40581799
Where do I put this code? In the control source?
0

LVL 37

Assisted Solution

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

Luke Chung earned 166 total points
ID: 40584511

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

Author Closing Comment

ID: 40599525
Thanks
0

## Featured Post

Question has a verified solution.

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

### Suggested Solutions

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
###### Suggested Courses
Course of the Month3 days, 14 hours left to enroll