Results 1 to 4 of 4
  1. #1
    kayakismet is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    4

    Sum of textboxes populated by subreports

    Thanks so much for getting me this far, folks!

    I am using WinXP, Access 2007. I searched many forums and MS, but nothing seems to fit this situation.

    I have a report, with 4 subreports. Each subreport now correctly displays its total on my main report. I need to sum all of those totals for a grand total, also on the main report. I can't get SUM to work right. I've heard I can't sum textboxes, but to get to where the totals show, I used some fairly long functions in those textboxes on the main form. Do I sum the functions? Or is there a better way to generate an #Error free Grand Total?

    I've attached a screenshot so folks can see whats going on:
    Textbox 1 is called "txt_ITDTotal"
    Textbox 2 is called "txt_OCMTotal"
    Textbox 3 is called "txt_NRCTotal"
    Textbox 4 is called "txt_MRCTotal"
    Textbox 5 is called "txt_OtherTotal"

    I tried this:
    =SUM(txt_ITDTotal)+SUM(txt_OCMTotal) ...etc


    but to no avail.

    But the function in each textbox is a version of:
    =IIf([srpt_ITD_Funded].[Report].[HasData],[srpt_ITD_Funded].[Report].[ITDCOST],0)

    Any help in sight? I am SO CLOSE to the finish line!

    Desperate in DC,
    Kaya

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    I don't think you can use the SUM function on control names, so try this in the control source of the GRAND box:
    Code:
    =me!txt_1 + me!txt_2
    etc, etc...

    if that doesn't work, try replacing "me!" with "reports!mainReportName!txt_1, etc..."

    if that doesn't work, try replacing "reports!mainReportName!txt_1 + etc, etc..." with "reports("mainReportName").controls("txt_1") + etc, etc...

    if that doesn't work, try summing them in code, on the LOAD event of the form and ending the code with:
    Code:
    me.Grandtotal = ResultOfCodeArithmetic
    HTH!

    ps - the second "try this" statement of mine most likely won't work, I just included it because I've never tried it before on a control source. I think that syntax is only meant to work in code.

  3. #3
    kayakismet is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    4

    Thank you!

    Quote Originally Posted by ajetrumpet View Post
    if that doesn't work, try replacing "me!" with "reports!mainReportName!txt_1, etc..."

    ...

    HTH!

    ps - the second "try this" statement of mine most likely won't work, I just included it because I've never tried it before on a control source. I think that syntax is only meant to work in code.

    Actually, the second one was precisely the thing that worked! You're amazing! Thanks SO MUCH Adam! You saved the day! (Again!)

    This place is so awesome...

    Kaya

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Great!

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

Similar Threads

  1. Having trouble dealing with these textboxes
    By blacksaibot in forum Programming
    Replies: 2
    Last Post: 04-28-2010, 12:10 PM
  2. subform comboboxes/Textboxes
    By terryvanduzee in forum Forms
    Replies: 2
    Last Post: 11-19-2009, 07:41 PM
  3. Two textboxes connected to the same table
    By ma09fraga in forum Forms
    Replies: 6
    Last Post: 06-11-2009, 12:42 PM
  4. Get average of unbound textboxes.
    By markhook in forum Forms
    Replies: 8
    Last Post: 07-14-2006, 09:30 AM
  5. CallTicketID populated to Order Form
    By EisBlade in forum Forms
    Replies: 0
    Last Post: 04-03-2006, 10:50 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