Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
434 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 40

Accepted Solution

by:
PatHartman earned 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

877 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