If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > How to count multiple text boxes in a Report

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #16 (permalink)  
Old 11-15-10, 16:16
Brian62 Brian62 is offline
Registered User
 
Join Date: Nov 2010
Posts: 24
This is in the table. I need to total all the yeses, No's and N/A's for all the columns. But right now I am trying to get the yeses to add up first then work on the rest.

Doc #2 Doc #25 Doc #36
Yes Yes Yes
Yes No Yes
Yes Yes No
Yes N/A Yes
No Yes Yes
Yes Yes No
Yes Yes Yes
Yes Yes Yes
Yes Yes Yes
Yes Yes Yes

I hope this answeres your question.
Reply With Quote
  #17 (permalink)  
Old 11-15-10, 16:19
HiTechCoach HiTechCoach is offline
Registered User
 
Join Date: May 2010
Posts: 600
Quote:
Originally Posted by Brian62 View Post
No. I need to have a total of all the yeses in all the columns. I will be adding more columns once the totals come out correctly.

Doc #2: has 9 Yes, 1 No
Doc #25: has 8 Yes, 1 NO, 1 N/A
Doc #36: Has 8 Yes, 2 No

Total should be 25. I hope this helps! Thanks!!
So you want a grand total of all the YES's.

This can be done by getting the total number of YES' in a record and then summing this total.


If the dataabse was properly design (normalized) this would be a very simply summing query.

Bascially you will need to count the YES's for each field (column) separately then add the individual totals together.
__________________
Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
Microsoft MVP - Access Expert
BPM/Accounting Systems/Inventory Control/CRM
Programming: Nine different ways to do it right, a thousand ways to do it wrong.
Binary--it's as easy as 1-10-11
Reply With Quote
  #18 (permalink)  
Old 11-15-10, 16:26
HiTechCoach HiTechCoach is offline
Registered User
 
Join Date: May 2010
Posts: 600
Quote:
Originally Posted by Brian62 View Post
This is in the table. I need to total all the yeses, No's and N/A's for all the columns. But right now I am trying to get the yeses to add up first then work on the rest.

Doc #2 Doc #25 Doc #36
Yes Yes Yes
Yes No Yes
Yes Yes No
Yes N/A Yes
No Yes Yes
Yes Yes No
Yes Yes Yes
Yes Yes Yes
Yes Yes Yes
Yes Yes Yes

I hope this answeres your question.
I did already understand that this was your table design. I just did not understand what it was you wanted to count.

Unfortunately with a table design that has repeating fields (not properly normalized ) will not be easy.

Because of so many repeating fields you can NOT get a single query to get what you want.
__________________
Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
Microsoft MVP - Access Expert
BPM/Accounting Systems/Inventory Control/CRM
Programming: Nine different ways to do it right, a thousand ways to do it wrong.
Binary--it's as easy as 1-10-11
Reply With Quote
  #19 (permalink)  
Old 11-15-10, 16:32
Brian62 Brian62 is offline
Registered User
 
Join Date: Nov 2010
Posts: 24
How would I go about and add each column to show total in one cell.

When I try this I get a total of the 9 cells with all the yeses.

SELECT Sum(RDStudyAuditSectionA.[Doc #2]) AS Total
FROM RDStudyAuditSectionA
HAVING (((Sum(RDStudyAuditSectionA.[Doc #2]))="Yes"));
Reply With Quote
  #20 (permalink)  
Old 11-15-10, 16:57
HiTechCoach HiTechCoach is offline
Registered User
 
Join Date: May 2010
Posts: 600
It will not be easy based on your current table design to get the grand total into a single field.


Depending in the number of fields you have you might still be able to use a UNION ALL query to convert your data to a properly normalized design. Then you could use a single query to get your counts.

If there are too many field then you could append the total for each field into a record in a table. You could then use a query to get the grand total counts.
__________________
Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
Microsoft MVP - Access Expert
BPM/Accounting Systems/Inventory Control/CRM
Programming: Nine different ways to do it right, a thousand ways to do it wrong.
Binary--it's as easy as 1-10-11

Last edited by HiTechCoach; 11-15-10 at 17:16.
Reply With Quote
  #21 (permalink)  
Old 11-16-10, 14:58
Sinndho Sinndho is online now
Registered User
 
Join Date: Mar 2009
Posts: 3,446
With your naming conventions (not very good ones, but you were already told that), it would have been (here for counting "Yes"):
Code:
SELECT Count(*) AS Total
FROM 
(SELECT [Doc #2] AS x FROM [RDStudyAuditSectionA]
UNION
SELECT [Doc #25] AS x FROM [RDStudyAuditSectionA]
UNION
SELECT [Doc #28-5] AS x FROM [RDStudyAuditSectionA]
UNION
SELECT [Doc #30] AS x FROM [RDStudyAuditSectionA]) 
AS Merged_Alias
WHERE Merged_Alias.x = 'Yes';
__________________
Have a nice day!
Reply With Quote
  #22 (permalink)  
Old 11-16-10, 15:42
HiTechCoach HiTechCoach is offline
Registered User
 
Join Date: May 2010
Posts: 600
Quote:
Originally Posted by Sinndho View Post
With your naming conventions (not very good ones, but you were already told that), it would have been (here for counting "Yes"):
Code:
SELECT Count(*) AS Total
FROM 
(SELECT [Doc #2] AS x FROM [RDStudyAuditSectionA]
UNION
SELECT [Doc #25] AS x FROM [RDStudyAuditSectionA]
UNION
SELECT [Doc #28-5] AS x FROM [RDStudyAuditSectionA]
UNION
SELECT [Doc #30] AS x FROM [RDStudyAuditSectionA]) 
AS Merged_Alias
WHERE Merged_Alias.x = 'Yes';
By Defauklt the UNION revonme dupicate records. I would recomend using UNION ALL. Otherwise you will probably get only one record resulting in a count of 1



I would use this:
Code:
SELECT Count(*) AS Total
FROM 
(SELECT [Doc #2] AS x FROM [RDStudyAuditSectionA]
UNION ALL
SELECT [Doc #25] AS x FROM [RDStudyAuditSectionA]
UNION ALL
SELECT [Doc #28-5] AS x FROM [RDStudyAuditSectionA]
UNION ALL
SELECT [Doc #30] AS x FROM [RDStudyAuditSectionA]) 
AS Merged_Alias
WHERE Merged_Alias.x = 'Yes';
__________________
Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
Microsoft MVP - Access Expert
BPM/Accounting Systems/Inventory Control/CRM
Programming: Nine different ways to do it right, a thousand ways to do it wrong.
Binary--it's as easy as 1-10-11
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On