Results 1 to 10 of 10
  1. #1
    tbjmobile@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    94

    Problem passing line total from sub report to report

    Hello Everybody,


    Can someone help please? I have started to create a report which will be a client monthly account. I have embedded a sub-report on it for work carried out during the month. The common field is customer code (cuscode). The report and sub-report are grouped therefore by cuscode and I'm working on forcing a page break after each cuscode group.
    I understand that I need to generate a total in the sub-report footer and I've seen it on a Youtube tutorial and a description on The Microsoft Office \ Access help site. I can't get it to work and so I can't move forward to passing it to the main report.
    The line total on the work sub report is a calculated control called 'TotJobRetail' with the expression =[RetailMats]+[HrsValue]+[CashOutNoProfit]
    The line totals are calculated correctly.
    On the footer I have tried =Sum([RetailMats]+[HrsValue]+[CashOutNoProfit]) which as far as I can see should do the trick.
    If anyone can help, please be aware that I am still very new to Access so please explain in as much detail as you can.
    Thanks.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    That should work, unless any of those referenced fields are really textboxes with calculations.

    What happens - error message, wrong results, nothing?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    tbjmobile@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    94
    Hi June7 and thanks.
    The other referenced fields are indeed text boxes with calculations. I thought I was better doing it that way than calculating the fields in the table.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Aggregate calcs must reference fields, not controls.

    Calculating in table Calculated type field is an option although many will advise against that.

    Either do the intermediate calcs in table/query or repeat them in the aggregate calc.
    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.

  5. #5
    tbjmobile@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    94
    O.k., thank you, I'll try the latter first.

  6. #6
    tbjmobile@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    94
    If I place all the calculations of the referenced fields in the =sum expression in the footer, does that mean I'll have to put all the controls that they reference in the footer as well?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    No part of the aggregate expression can reference controls.
    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.

  8. #8
    tbjmobile@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    94
    Got it, thanks.

  9. #9
    tbjmobile@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    94
    Sorry, no I haven't got it! What I mean is that to make the calculated 'total' control in the sub report function, I had to place all of the other controls that it referenced into the sub report somewhere. So do I have to put them in the footer as also. I suppose I'll find out as I try though, just thought it might be a rule I should know.

  10. #10
    tbjmobile@gmail.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    94
    I do understand what you said now, apologies. The aggregate expression must be a field directly from the table which has been calculated, or from a query that queries the fields in the same manner.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-22-2015, 03:23 AM
  2. Replies: 2
    Last Post: 03-23-2015, 08:32 AM
  3. Replies: 3
    Last Post: 01-18-2015, 06:05 PM
  4. Replies: 1
    Last Post: 06-29-2010, 03:40 AM
  5. Passing parameters to a report
    By elmousa68 in forum Access
    Replies: 0
    Last Post: 12-07-2006, 01:38 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