Results 1 to 4 of 4
  1. #1
    AccessThomas is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2015
    Posts
    26

    Total of checked field

    I have a field that uses checkboxes in my table. What would be the best way to sum the amount that are checked and put the total in the form detail section or footer if need be?

    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,915
    You want to count how many records are Yes?

    Sum(Abs([fieldname]))

    Or you want to sum another field for only those records that are Yes?

    Sum(IIf([field1]=True, [field2], 0))
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,421
    checkboxes are Boolean values which are numeric - i.e. -1 for true or yes and 0 for no or false

    so depends on where your source is but the basic formula would be

    sum(abs(chkboxfield))

    e.g.

    dsum("abs(chkboxfield)","myTable")

    or you could use

    abs(dsum("chkboxfield","mytable")

    or in a query, something like

    SELECT sum(abs(chkboxfield)) FROM myTable

  4. #4
    AccessThomas is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2015
    Posts
    26
    Thanks a lot. That worked.

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

Similar Threads

  1. Automatically update a field when a box is checked
    By strangebiscuit in forum Access
    Replies: 11
    Last Post: 07-24-2014, 11:52 AM
  2. Date field updated when box checked
    By Sienna in forum Forms
    Replies: 6
    Last Post: 03-06-2014, 11:57 AM
  3. Forms, text box only visible when yes/no field checked
    By Remillard in forum Programming
    Replies: 6
    Last Post: 04-15-2013, 12:59 PM
  4. Replies: 1
    Last Post: 02-15-2013, 08:44 AM
  5. Replies: 4
    Last Post: 03-02-2012, 08:41 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