Results 1 to 6 of 6
  1. #1
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167

    summing checked boxes

    HI I have a continuous form with a check box field that i would like to sum totals on.



    currently i have a txt box in the form footer as follows: =Sum([Buy Rate])

    This gives me the total of all the records in the table.
    What i would like to do is only total the [Buy Rate] fields of the boxes that have the [pymt requested] check box clicked.

    Can anyone tell me how to alter the =Sum([Buy Rate]) expression to only show the records with the check box clicked?

    thanks in advance.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Take a look at the DSum() function. Something like:

    =DSum("[Buy Rate]","YourTableName","[pymt requested]=-1")
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    you can also try

    =-sum([Buy Rate] * [pymt requested])

  4. #4
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    I think that did the trick
    thanks!

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    I'm glad to hear that something has worked for you.

    Did both suggestions work?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Quote Originally Posted by fishhead View Post
    HI I have a continuous form with a check box field that i would like to sum totals on.

    currently i have a txt box in the form footer as follows: =Sum([Buy Rate])

    This gives me the total of all the records in the table.
    What i would like to do is only total the [Buy Rate] fields of the boxes that have the [pymt requested] check box clicked.

    Can anyone tell me how to alter the =Sum([Buy Rate]) expression to only show the records with the check box clicked?

    thanks in advance.
    Another method or readability:

    Code:
    =Sum(IIF( [pymt requested],[Buy Rate],0))
    or

    Code:
    =Sum(IIF([pymt requested]=True,[Buy Rate],0))

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

Similar Threads

  1. Replies: 12
    Last Post: 12-31-2019, 07:37 AM
  2. Count Checked boxes on report
    By BLFOSTER in forum Reports
    Replies: 2
    Last Post: 06-22-2015, 09:33 AM
  3. Summing up text boxes
    By data808 in forum Access
    Replies: 7
    Last Post: 05-12-2014, 07:56 AM
  4. Replies: 2
    Last Post: 03-08-2014, 02:45 AM
  5. Replies: 54
    Last Post: 07-17-2013, 03:01 PM

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