Calculated by Group

S

Sunflower

I have a Main report
Grouped by Month
Then Grouped by Department...

I have a Subreport in the Department group header of my Main report.
The Subreport is grouped by Job
and all the Expenses for the job are in the details.
I have a Total in the report footer of my sub report.

My question:
How do I get the Total from my Subreport to my Main report,
calculating all the Expenses by Department?

Any and all help much appreciated.
 
A

Allen Browne

See:
Bring the total from a subreport onto a main report
at:
http://allenbrowne.com/casu-18.html

If you also need a grand total in the Report Footer of your main report, get
the above working, and then add a 2nd text box to the same section as your
subreport. Assuming the text box that shows the dept total from the
subreport is named txtDeptTotal, set these properties for the 2nd text box:
Control Source =[txtDeptTotal]
Running Sum Over All
Format Currency {or General Number if you prefer}
Visible No
Name txtDeptTotalRS

Now you can add a text box to the Report Footer section, and get it to show
the grand total by setting its Control Source to:
=[txtDeptTotalRS]
 
M

Marshall Barton

Sunflower said:
I have a Main report
Grouped by Month
Then Grouped by Department...

I have a Subreport in the Department group header of my Main report.
The Subreport is grouped by Job
and all the Expenses for the job are in the details.
I have a Total in the report footer of my sub report.

My question:
How do I get the Total from my Subreport to my Main report,
calculating all the Expenses by Department?


A main report textbox (in the same section as the subreport)
can display the subreport total by using an expression like:

=subreportcontrol.Report.totaltextbox

If there's any chance that a department might not have any
expenses, the use this instead:

=IIf(subreportcontrol.Report.HasData,
subreportcontrol.Report.totaltextbox, 0)
 
S

Sunflower

See:
Bring the total from a subreport onto a main report
at:
http://allenbrowne.com/casu-18.html

If you also need a grand total in the Report Footer of your main report, get
the above working, and then add a 2nd text box to the same section as your
subreport. Assuming the text box that shows the dept total from the
subreport is named txtDeptTotal, set these properties for the 2nd text box:
Control Source =[txtDeptTotal]
Running Sum Over All
Format Currency {or General Number if you prefer}
Visible No
Name txtDeptTotalRS

Now you can add a text box to the Report Footer section, and get it to show
the grand total by setting its Control Source to:
=[txtDeptTotalRS]

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.




I have a Main report
Grouped by Month
Then Grouped by Department...
I have a Subreport in the Department group header of my Main report.
The Subreport is grouped by Job
and all the Expenses for the job are in the details.
I have a Total in the report footer of my sub report.
My question:
How do I get the Total from my Subreport to my Main report,
calculating all the Expenses by Department?
Any and all help much appreciated.- Hide quoted text -

- Show quoted text -

I have tried your method and I get the #Error

Here is my report structure...

MAIN REPORT = [rptMONTHLYBILLBACKS]
--Report Header---------------
--Page Header-----------------
--DueDate Header--------------
[Month] =Format([dbo_RB_JOB.DUEDATE],"mmm"", ""yyyy")

--Department Header-----------
[Department]

--JobID Header----------------
JobID
JobName
Categoryname

====SUBREPORT = [subrptJOBEXPENSE]===================
--Report Header---------------
--Page Header-----------------
--JobID Header----------------

--Detail----------------------
Vendor
Categoryname
Quantity
Unitcost
Totalcost

--JobID Footer--------------------
[TOTAL] =Sum([QUANTITY]*[UNITCOST])

--Page Footer------------------
--Report Footer----------------
[txtDeptTotal] =Sum([QUANTITY]*[UNITCOST])
=====================================================

[JobTotal] =subrptJobExpense.Report!txtDeptTotal
[txtDeptTotalRS] =[JOBTOTAL]

--Detail----------------------
--JobID footer-----------------
--Department Footer------------
[GrandTotal] =[txtDeptTotalRS]

--DueDate Footer---------------
--Page Footer------------------
--Report Footer----------------

Am I putting the txtboxes in the correct section?

I am sorry for not getting this quickly, I am very new to Access

Thanks for your help
 
A

Allen Browne

Where does the #Error occur?

To solve this, temporarily eliminate the later boxes (GrandTotal and
txtDeptTotalRS) until you get the others working.

Does the subreport's txtDeptTotal show correctly?

If so, does JobTotal on the main report being it back correctly?
If there could ever be a category that has no expense, you might want to
use:
=IIf([subrptJOBEXPENSE].[Report].[HasData],
Nz([subrptJOBEXPENSE].Report].[txtDeptTotal], 0), 0)
Explanation:
http://allenbrowne.com/casu-18.html

Once that's working, txtDetpTotalRS should work.

And then GrandTotal should work.

If it's still broken, indicate which text box in the queue is the one that
fails.

(Note that if you don't eliminate the later ones, the #Error can occur in
several places, and you don't know the critical point. Once Access is unable
to calculate a calculated control, is shows #Error for the others as well.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Sunflower said:
See:
Bring the total from a subreport onto a main report
at:
http://allenbrowne.com/casu-18.html

If you also need a grand total in the Report Footer of your main report,
get
the above working, and then add a 2nd text box to the same section as
your
subreport. Assuming the text box that shows the dept total from the
subreport is named txtDeptTotal, set these properties for the 2nd text
box:
Control Source =[txtDeptTotal]
Running Sum Over All
Format Currency {or General Number if you
prefer}
Visible No
Name txtDeptTotalRS

Now you can add a text box to the Report Footer section, and get it to
show
the grand total by setting its Control Source to:
=[txtDeptTotalRS]

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.




I have a Main report
Grouped by Month
Then Grouped by Department...
I have a Subreport in the Department group header of my Main report.
The Subreport is grouped by Job
and all the Expenses for the job are in the details.
I have a Total in the report footer of my sub report.
My question:
How do I get the Total from my Subreport to my Main report,
calculating all the Expenses by Department?
Any and all help much appreciated.- Hide quoted text -

- Show quoted text -

I have tried your method and I get the #Error

Here is my report structure...

MAIN REPORT = [rptMONTHLYBILLBACKS]
--Report Header---------------
--Page Header-----------------
--DueDate Header--------------
[Month] =Format([dbo_RB_JOB.DUEDATE],"mmm"", ""yyyy")

--Department Header-----------
[Department]

--JobID Header----------------
JobID
JobName
Categoryname

====SUBREPORT = [subrptJOBEXPENSE]===================
--Report Header---------------
--Page Header-----------------
--JobID Header----------------

--Detail----------------------
Vendor
Categoryname
Quantity
Unitcost
Totalcost

--JobID Footer--------------------
[TOTAL] =Sum([QUANTITY]*[UNITCOST])

--Page Footer------------------
--Report Footer----------------
[txtDeptTotal] =Sum([QUANTITY]*[UNITCOST])
=====================================================

[JobTotal] =subrptJobExpense.Report!txtDeptTotal
[txtDeptTotalRS] =[JOBTOTAL]

--Detail----------------------
--JobID footer-----------------
--Department Footer------------
[GrandTotal] =[txtDeptTotalRS]

--DueDate Footer---------------
--Page Footer------------------
--Report Footer----------------

Am I putting the txtboxes in the correct section?

I am sorry for not getting this quickly, I am very new to Access

Thanks for your help
 
S

Sunflower

Where does the #Error occur?

To solve this, temporarily eliminate the later boxes (GrandTotal and
txtDeptTotalRS) until you get the others working.

Does the subreport's txtDeptTotal show correctly?

If so, does JobTotal on the main report being it back correctly?
If there could ever be a category that has no expense, you might want to
use:
=IIf([subrptJOBEXPENSE].[Report].[HasData],
Nz([subrptJOBEXPENSE].Report].[txtDeptTotal], 0), 0)
Explanation:
http://allenbrowne.com/casu-18.html

Once that's working, txtDetpTotalRS should work.

And then GrandTotal should work.

If it's still broken, indicate which text box in the queue is the one that
fails.

(Note that if you don't eliminate the later ones, the #Error can occur in
several places, and you don't know the critical point. Once Access is unable
to calculate a calculated control, is shows #Error for the others as well.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.




See:
Bring the total from a subreport onto a main report
at:
http://allenbrowne.com/casu-18.html
If you also need a grand total in the Report Footer of your main report,
get
the above working, and then add a 2nd text box to the same section as
your
subreport. Assuming the text box that shows the dept total from the
subreport is named txtDeptTotal, set these properties for the 2nd text
box:
Control Source =[txtDeptTotal]
Running Sum Over All
Format Currency {or General Number if you
prefer}
Visible No
Name txtDeptTotalRS
Now you can add a text box to the Report Footer section, and get it to
show
the grand total by setting its Control Source to:
=[txtDeptTotalRS]
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

I have a Main report
Grouped by Month
Then Grouped by Department...
I have a Subreport in the Department group header of my Main report.
The Subreport is grouped by Job
and all the Expenses for the job are in the details.
I have a Total in the report footer of my sub report.
My question:
How do I get the Total from my Subreport to my Main report,
calculating all the Expenses by Department?
Any and all help much appreciated.- Hide quoted text -
- Show quoted text -
I have tried your method and I get the #Error
Here is my report structure...
MAIN REPORT = [rptMONTHLYBILLBACKS]
--Report Header---------------
--Page Header-----------------
--DueDate Header--------------
[Month] =Format([dbo_RB_JOB.DUEDATE],"mmm"", ""yyyy")
--Department Header-----------
[Department]
--JobID Header----------------
JobID
JobName
Categoryname
====SUBREPORT = [subrptJOBEXPENSE]===================
--Report Header---------------
--Page Header-----------------
--JobID Header----------------
--Detail----------------------
Vendor
Categoryname
Quantity
Unitcost
Totalcost

--JobID Footer--------------------
[TOTAL] =Sum([QUANTITY]*[UNITCOST])
--Page Footer------------------
--Report Footer----------------
[txtDeptTotal] =Sum([QUANTITY]*[UNITCOST])
=====================================================
[JobTotal] =subrptJobExpense.Report!txtDeptTotal
[txtDeptTotalRS] =[JOBTOTAL]
--Detail----------------------
--JobID footer-----------------
--Department Footer------------
[GrandTotal] =[txtDeptTotalRS]
--DueDate Footer---------------
--Page Footer------------------
--Report Footer----------------
Am I putting the txtboxes in the correct section?
I am sorry for not getting this quickly, I am very new to Access
Thanks for your help- Hide quoted text -

- Show quoted text -

I no longer get the #Error.
However, the GrandTotal is still not working the way I had hoped...
I am getting a running sum for the entire report, I need the sum of
each month by Dept group.
I thought by putting the "GrandTotal" in the Department Footer it
would calculate/sum just the expenses found for the dept for the
month.

I appreciate your helping me with this
 
A

Allen Browne

You may be able to solve this by changing the Running Sum property from Over
All to Over Group.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Sunflower said:
Where does the #Error occur?

To solve this, temporarily eliminate the later boxes (GrandTotal and
txtDeptTotalRS) until you get the others working.

Does the subreport's txtDeptTotal show correctly?

If so, does JobTotal on the main report being it back correctly?
If there could ever be a category that has no expense, you might want to
use:
=IIf([subrptJOBEXPENSE].[Report].[HasData],
Nz([subrptJOBEXPENSE].Report].[txtDeptTotal], 0), 0)
Explanation:
http://allenbrowne.com/casu-18.html

Once that's working, txtDetpTotalRS should work.

And then GrandTotal should work.

If it's still broken, indicate which text box in the queue is the one
that
fails.

(Note that if you don't eliminate the later ones, the #Error can occur in
several places, and you don't know the critical point. Once Access is
unable
to calculate a calculated control, is shows #Error for the others as
well.)




On Apr 26, 10:21 pm, "Allen Browne" <[email protected]>
wrote:
See:
Bring the total from a subreport onto a main report
at:
http://allenbrowne.com/casu-18.html
If you also need a grand total in the Report Footer of your main
report,
get
the above working, and then add a 2nd text box to the same section as
your
subreport. Assuming the text box that shows the dept total from the
subreport is named txtDeptTotal, set these properties for the 2nd text
box:
Control Source =[txtDeptTotal]
Running Sum Over All
Format Currency {or General Number if you
prefer}
Visible No
Name txtDeptTotalRS
Now you can add a text box to the Report Footer section, and get it to
show
the grand total by setting its Control Source to:
=[txtDeptTotalRS]
I have a Main report
Grouped by Month
Then Grouped by Department...
I have a Subreport in the Department group header of my Main report.
The Subreport is grouped by Job
and all the Expenses for the job are in the details.
I have a Total in the report footer of my sub report.
My question:
How do I get the Total from my Subreport to my Main report,
calculating all the Expenses by Department?
Any and all help much appreciated.- Hide quoted text -
- Show quoted text -
I have tried your method and I get the #Error
Here is my report structure...
MAIN REPORT = [rptMONTHLYBILLBACKS]
--Report Header---------------
--Page Header-----------------
--DueDate Header--------------
[Month] =Format([dbo_RB_JOB.DUEDATE],"mmm"", ""yyyy")
--Department Header-----------
[Department]
--JobID Header----------------
JobID
JobName
Categoryname
====SUBREPORT = [subrptJOBEXPENSE]===================
--Report Header---------------
--Page Header-----------------
--JobID Header----------------
--Detail----------------------
Vendor
Categoryname
Quantity
Unitcost
Totalcost

--JobID Footer--------------------
[TOTAL] =Sum([QUANTITY]*[UNITCOST])
--Page Footer------------------
--Report Footer----------------
[txtDeptTotal] =Sum([QUANTITY]*[UNITCOST])
=====================================================
[JobTotal] =subrptJobExpense.Report!txtDeptTotal
[txtDeptTotalRS] =[JOBTOTAL]
--Detail----------------------
--JobID footer-----------------
--Department Footer------------
[GrandTotal] =[txtDeptTotalRS]
--DueDate Footer---------------
--Page Footer------------------
--Report Footer----------------
Am I putting the txtboxes in the correct section?
I am sorry for not getting this quickly, I am very new to Access
Thanks for your help- Hide quoted text -

- Show quoted text -

I no longer get the #Error.
However, the GrandTotal is still not working the way I had hoped...
I am getting a running sum for the entire report, I need the sum of
each month by Dept group.
I thought by putting the "GrandTotal" in the Department Footer it
would calculate/sum just the expenses found for the dept for the
month.

I appreciate your helping me with this
 
S

Sunflower

You may be able to solve this by changing the Running Sum property from Over
All to Over Group.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.




Where does the #Error occur?
To solve this, temporarily eliminate the later boxes (GrandTotal and
txtDeptTotalRS) until you get the others working.
Does the subreport's txtDeptTotal show correctly?
If so, does JobTotal on the main report being it back correctly?
If there could ever be a category that has no expense, you might want to
use:
=IIf([subrptJOBEXPENSE].[Report].[HasData],
Nz([subrptJOBEXPENSE].Report].[txtDeptTotal], 0), 0)
Explanation:
http://allenbrowne.com/casu-18.html
Once that's working, txtDetpTotalRS should work.
And then GrandTotal should work.
If it's still broken, indicate which text box in the queue is the one
that
fails.
(Note that if you don't eliminate the later ones, the #Error can occur in
several places, and you don't know the critical point. Once Access is
unable
to calculate a calculated control, is shows #Error for the others as
well.)

On Apr 26, 10:21 pm, "Allen Browne" <[email protected]>
wrote:
See:
Bring the total from a subreport onto a main report
at:
http://allenbrowne.com/casu-18.html
If you also need a grand total in the Report Footer of your main
report,
get
the above working, and then add a 2nd text box to the same section as
your
subreport. Assuming the text box that shows the dept total from the
subreport is named txtDeptTotal, set these properties for the 2nd text
box:
Control Source =[txtDeptTotal]
Running Sum Over All
Format Currency {or General Number if you
prefer}
Visible No
Name txtDeptTotalRS
Now you can add a text box to the Report Footer section, and get it to
show
the grand total by setting its Control Source to:
=[txtDeptTotalRS]
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

I have a Main report
Grouped by Month
Then Grouped by Department...
I have a Subreport in the Department group header of my Main report.
The Subreport is grouped by Job
and all the Expenses for the job are in the details.
I have a Total in the report footer of my sub report.
My question:
How do I get the Total from my Subreport to my Main report,
calculating all the Expenses by Department?
Any and all help much appreciated.- Hide quoted text -
- Show quoted text -
I have tried your method and I get the #Error
Here is my report structure...
MAIN REPORT = [rptMONTHLYBILLBACKS]
--Report Header---------------
--Page Header-----------------
--DueDate Header--------------
[Month] =Format([dbo_RB_JOB.DUEDATE],"mmm"", ""yyyy")
--Department Header-----------
[Department]
--JobID Header----------------
JobID
JobName
Categoryname
====SUBREPORT = [subrptJOBEXPENSE]===================
--Report Header---------------
--Page Header-----------------
--JobID Header----------------
--Detail----------------------
Vendor
Categoryname
Quantity
Unitcost
Totalcost
--JobID Footer--------------------
[TOTAL] =Sum([QUANTITY]*[UNITCOST])
--Page Footer------------------
--Report Footer----------------
[txtDeptTotal] =Sum([QUANTITY]*[UNITCOST])
=====================================================
[JobTotal] =subrptJobExpense.Report!txtDeptTotal
[txtDeptTotalRS] =[JOBTOTAL]
--Detail----------------------
--JobID footer-----------------
--Department Footer------------
[GrandTotal] =[txtDeptTotalRS]
--DueDate Footer---------------
--Page Footer------------------
--Report Footer----------------
Am I putting the txtboxes in the correct section?
I am sorry for not getting this quickly, I am very new to Access
Thanks for your help- Hide quoted text -
- Show quoted text -
I no longer get the #Error.
However, the GrandTotal is still not working the way I had hoped...
I am getting a running sum for the entire report, I need the sum of
each month by Dept group.
I thought by putting the "GrandTotal" in the Department Footer it
would calculate/sum just the expenses found for the dept for the
month.
I appreciate your helping me with this- Hide quoted text -

- Show quoted text -

That was it! It works! Thank you so much !!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top