Solved

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

Posted on 2015-01-31
5
145 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 34

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

860 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