Solved

Trying to sum the value of a number field on a main report and the value of a number field on a subreport

Posted on 2014-02-11
4
417 Views
Last Modified: 2014-02-11
I'm rrying to sum the value of a number field on a main report and the value of a number field on a subreport that is in the main report.

Here is what I have but it doesn't work:

=[txtRegHrs]+[Reports]![subrptTimeCardDataEntryCostCtrsGrp3Payroll]![txtRegHrs]
0
Comment
Question by:SteveL13
  • 2
4 Comments
 
LVL 14

Expert Comment

by:Bill Ross
ID: 39851462
Hi,

Place the controls in the report footer and subreport footer

=Sum(txtRegHrs])   <-Sub Report name control txtTotalSub

=Sum(txtRegHrs])  + [subrptTimeCardDataEntryCostCtrsGrp3Payroll].report!txtTotalSub  <-Main Report  name control txtTotalMain

note that [subrptTimeCardDataEntryCostCtrsGrp3Payroll] is the name of the control holding the subreport not the name of the subreport although they can be the same.

regards,

Bill
0
 
LVL 35

Accepted Solution

by:
PatHartman earned 500 total points
ID: 39851470
Since a subreport can have multiple rows, exactly which row did you want to reference?

What I would do is create a totals query that sums to the level I need.  Then since this is a report, I can change my RecordSource query to join to the totals query which will let me bind a column to the total.  Then my expression would be

=Nz(txtRegHrs,0) + Nz(SumRegHrs,0)
0
 

Author Comment

by:SteveL13
ID: 39851547
I'm trying to reference this in the field in the footer of the main report...

txtGroupRegHrsTotal

and in the subreport I'm trying to reference this in the footer of the sub-report...

txtCostCtrGroupRegHrsTotal

Here is what I have but still not working.

=Sum([txtGroupRegHrsTotal]+[subrptTimeCardDataEntryCostCtrsGrp3Payroll].[Report]![txtCostCtrGroupRegHrsTotal])
0
 

Author Closing Comment

by:SteveL13
ID: 39851595
This solution worked out perfectly for me.  Thank you!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now