Results 1 to 14 of 14
  1. #1
    TK03 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    7

    Totals of Check boxes marked yes in query

    I am trying to get a report off a data based used for tech services. If parts fail under warranty the tech will click a text box set up for all the major parts.
    I want to have the query gather only boxes that are checked which it does now bit I want to know how many of each checked box.
    There are a total of about 20 check boxes and I need a count of each group of check boxes checked.
    For instance;
    Check boxes Blower, sensor, control, gas valve ETC.
    Report how many of each group.


    Thanks in advance.

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    If the fields represented by the checkboxes are defined as true boolean fields (Yes/No) you can simply use Sum(Abs(BlowerChecked)),Sum(Abs(SensorChecked)), ...
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

  4. #4
    TK03 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    7
    These are the check boxes along with a date and serial number all in one table.
    Click image for larger version. 

Name:	Checkbaxes.PNG 
Views:	19 
Size:	22.6 KB 
ID:	40653
    Query Partial view
    Click image for larger version. 

Name:	Query.PNG 
Views:	18 
Size:	9.4 KB 
ID:	40654
    If I put "Yes" in any one of the fields I get only the ones checked yes. What I want is just how many in each field were check. IE, Supply Sensor 7, Return sensor 5, vent sensor 3, Flame sensor 9 ETC.
    I thought I could keep it simple and just add something in the criteria to make this happen.
    Thanks

  5. #5
    TK03 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    7
    Where does this get added? Tried in the criteria but got error
    Sum(Abs(SupplySensorChecked))

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

  7. #7
    Bulzie is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,469
    In your query design, click the Totals button, then in the Total: row select "Count" as the option on all the Y/N fields. If you want to limit records say by a date range, put that in the Criteria row for the date field(which you should not have named "Date" just fyi) and select Where in the Total: field. Get rid of the Record# and Serial fields since you are just getting total counts it sounds like.

  8. #8
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    That was just a name I came up with, try Sum(Abs([Supply Sensor])), Sum(Abs([Return Sensor])), etc. You need to make the query a totals query (click on the sum - sigma- sign on the ribbon).

    Cheers,

    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  9. #9
    TK03 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    7
    Quote Originally Posted by Bulzie View Post
    In your query design, click the Totals button, then in the Total: row select "Count" as the option on all the Y/N fields. If you want to limit records say by a date range, put that in the Criteria row for the date field(which you should not have named "Date" just fyi) and select Where in the Total: field. Get rid of the Record# and Serial fields since you are just getting total counts it sounds like.
    I did this but it returned data for all fields equal to the number of checked boxes even if the box was not checked. I have 40 test records. I have I chose 4 test fields and checked 10 check boxes of each of the check box fields. The result returned was 40 of each of the 4 test fields instead of 10 of each.
    I put yes in the criteria and it returned 0 results of any fields.
    Click image for larger version. 

Name:	4 fields.PNG 
Views:	16 
Size:	6.5 KB 
ID:	40655

  10. #10
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    TK03,
    Sorry for the mishaps, it seems I haven't quite explained how this should work.
    The boolean field (Yes/No) actually stores 0 for No (False) and -1 for Yes (True). The built in ABS function returns the absolute (positive) value of that, so summing them would give you the count: https://www.techonthenet.com/access/...umeric/abs.php

    So to implement that you need to select Expression instead of Count in the totals row of your totals query and in the field row use something like that: Return_Sensor_Count:Sum(Abs([Return Sensor])),Vent_Sensor_Count:Sum(Abs([Vent Sensor]))..........

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  11. #11
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @TK03

    Be aware your field names are not the best:
    Use only letters and numbers (exception is the underscore) for object names.
    Do not use spaces, punctuation or special characters in object names.
    Do not begin an object name with a number.
    Do not use Look up FIELDS, multi-Value fields or Calculated fields in tables.

    Also, be aware that "DATE" is a reserved word and shouldn't be used as an object name.
    See Problem names and reserved words in Access



    Bad: Record#
    Bad : Serial Number (space in name)
    Bad: Supply/High

  12. #12
    TK03 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    7
    Thanks Vlad, Works perfectly

  13. #13
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    TK03,
    Glad you have it resolved.
    You can mark the thread Solved by reviewing this.

  14. #14
    Mickjav is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Location
    Margate, Kent
    Posts
    123
    Sorry to but in but I think there is an issue with the design in that you are adding parts as fields in a table which you will run out of.

    I don't know how your using you table but if it's for parts and workorders I would have a basic stucture like:

    tblParts
    tblPartsAssigned
    tblPartsCategories

    mick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Create query from a Form with Check Boxes
    By jose.antony@hotmail.com in forum Access
    Replies: 6
    Last Post: 05-04-2018, 02:56 PM
  2. Replies: 2
    Last Post: 07-12-2016, 12:11 PM
  3. Generate report, using check boxes or query
    By rumenrs in forum Reports
    Replies: 15
    Last Post: 04-10-2013, 01:46 PM
  4. How to Query fields with check boxes?
    By JynxRD in forum Queries
    Replies: 2
    Last Post: 09-10-2010, 08:35 PM
  5. Replies: 2
    Last Post: 03-20-2010, 11:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums