Solved

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

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

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:LukeChung-FMS
LukeChung-FMS 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now