473,395 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

On Access Report: Need expr. that will count records where 2 chkbxs are "true"

20
Have an Access report in which Column A and Column B are checkboxes. Already have totals for each column and percentages. Now need to write an expression that will count the instances in which both boxes are checked for a record. Cannot seem to get there. I am not a programmer. Any help would be appreciated.
Aug 21 '10 #1

✓ answered by liimra


Although
the question is not really clear here we go. Conditional expression can be the solution.
Before I continue, you must know that the values for the check box or Yes/No Field are obviously yes or no/ ticked or unticked and in numbers language it is 0 & -1.
Yes = -1 & No = 0


I assume the names of the First Column And Second are "A" & "B" respectively, and both are check boxes (Please change Names to the exact names you have if they are different). Simply add a text box (third column) and write this expression inside:
Expand|Select|Wrap|Line Numbers
  1. =IIf([A]=0 And [b]=0,0,IIf([A]=0 And [b]=-1,0,IIf([A]=-1 And [b]=0,0,"1")))
.

Add the field which you want it to count the number of records which have both fields checked and paste this conditional expression:
Expand|Select|Wrap|Line Numbers
  1. =sum(=IIf([A]=0 And [b]=0,0,IIf([A]=0 And [b]=-1,0,IIf([A]=-1 And [b]=0,0,"1"))))
This way is very flexible and you can adjust it to the way you want. Of course, it would be better to add this formula/expression in a query but for simplicity you can just add it to your report.

Just to make everything will be clear, I have attached database which contains the above example. In the same database, I have added another report (called extended) which looks better (Tells where both are checked and gives the total)


Regards,
Ali

2 2271
liimra
119 100+

Although
the question is not really clear here we go. Conditional expression can be the solution.
Before I continue, you must know that the values for the check box or Yes/No Field are obviously yes or no/ ticked or unticked and in numbers language it is 0 & -1.
Yes = -1 & No = 0


I assume the names of the First Column And Second are "A" & "B" respectively, and both are check boxes (Please change Names to the exact names you have if they are different). Simply add a text box (third column) and write this expression inside:
Expand|Select|Wrap|Line Numbers
  1. =IIf([A]=0 And [b]=0,0,IIf([A]=0 And [b]=-1,0,IIf([A]=-1 And [b]=0,0,"1")))
.

Add the field which you want it to count the number of records which have both fields checked and paste this conditional expression:
Expand|Select|Wrap|Line Numbers
  1. =sum(=IIf([A]=0 And [b]=0,0,IIf([A]=0 And [b]=-1,0,IIf([A]=-1 And [b]=0,0,"1"))))
This way is very flexible and you can adjust it to the way you want. Of course, it would be better to add this formula/expression in a query but for simplicity you can just add it to your report.

Just to make everything will be clear, I have attached database which contains the above example. In the same database, I have added another report (called extended) which looks better (Tells where both are checked and gives the total)


Regards,
Ali
Attached Files
File Type: zip Both.zip (33.1 KB, 130 views)
Aug 22 '10 #2
cambar
20
Thanks so much for your response. Adjusted my query to obtain the responses I needed. Your response, in part, helped me correct what was missing in the expression I was using.
Aug 22 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: lawrence | last post by:
In the following loop, at the end, the method debugNotes() is printing out some notes for me to read, so I can figure out what is going on in my script. Where I try to print out the value of the...
1
by: nick | last post by:
Hi What is the proper way of setting a boolean column (checkbox) to "true" by default? It seems that the datagrid won't accept inserts if the default is true. BoolColPaid = new...
4
by: Bradley Plett | last post by:
I have what should be a trivial problem. I am using XMLSerializer to serialize an object. It serializes boolean values as "True" and "False". I then want to use an XSLT on this XML, and I want...
3
by: Kathy Burke | last post by:
Hi. Totally lost on this one (ok, I admit I'm USUALLY lost!). All works fine in dev environment (P4, localhost server IIS, XP Pro) Asp.net and .Net 1.1 In order to access doc files needed for...
1
by: Edward Yang | last post by:
I setup web.config with impersonation="true". On our local server the project works great. I did the same procedures on our staging server, but it failed with an impossible error: Server Error in...
2
by: Guy Lafleur | last post by:
I have a user control that builds a treeview dynamically in the Page_Load event. Also, I have the AutoEventWireup property set to true (i.e., <%@ Control AutoEventWireup="true" %>). Then, when I...
3
by: Raghuram | last post by:
Hi, What is the use of <Identity Impersonate="true" /> How can we implement this in an ASP.NET application When are we supposed to use this. please provide me the details with an Example....
0
by: Sachin | last post by:
Hi All, I am using ASP.NET 2.0 and GridView control. I have a stored procedure, SP_GetAllRows which takes the table name as parameter and fires the query "Select * from TableName" dynamically....
9
by: Jamey Bon | last post by:
As a newbie to C#, I am not sure what I can do about this. I would like to do something like an Enumeration to use "constants" like Yes to indicate true and No for false. But since there seems to...
1
by: eclipse93081 | last post by:
I need a way to sum check boxes in Access. On the database interface I have 3 boxes you can check; "Scheduled/Went On", "Scheduled/Did Not Go On", and "Not Scheduled". I have the boxes set up as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.