A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I sum a total from multiple sub reports onto a main report



 
 
Thread Tools Display Modes
  #1  
Old June 3rd, 2005, 10:59 PM
Skiman1234
external usenet poster
 
Posts: n/a
Default How do I sum a total from multiple sub reports onto a main report

I am trying to sum amounts contained in sub-reports on to the main report
that contains the sub-reports. Is this possible? If so, does anyone know
what the syntax is?

thanks
  #2  
Old June 3rd, 2005, 11:15 PM
Steve Schapel
external usenet poster
 
Posts: n/a
Default

Skiman,

In an unbound tetxbox on the main form, enter its Control Source like
this...

=[SubReport1]![1stAmount]+[SubReport2]![2ndAmount]+[SubReport3]![3rdAmount]

This assumes the applicable controls on all subreports will always have
a value, otherwise you will need some refinements to cater to Nulls or
subreports with no data.

--
Steve Schapel, Microsoft Access MVP


Skiman1234 wrote:
I am trying to sum amounts contained in sub-reports on to the main report
that contains the sub-reports. Is this possible? If so, does anyone know
what the syntax is?

thanks

  #3  
Old November 13th, 2005, 01:47 AM
CotoJoe
external usenet poster
 
Posts: n/a
Default How do I sum a total from multiple sub reports onto a main rep

Dear Steve,

Saw your post about this and I am having the trouble you mentioned about
sub-reports having no values, therefore I am getting a #error message. Can
you tell me how I get around this?
--
CotoJoe


"Steve Schapel" wrote:

Skiman,

In an unbound tetxbox on the main form, enter its Control Source like
this...

=[SubReport1]![1stAmount]+[SubReport2]![2ndAmount]+[SubReport3]![3rdAmount]

This assumes the applicable controls on all subreports will always have
a value, otherwise you will need some refinements to cater to Nulls or
subreports with no data.

--
Steve Schapel, Microsoft Access MVP


Skiman1234 wrote:
I am trying to sum amounts contained in sub-reports on to the main report
that contains the sub-reports. Is this possible? If so, does anyone know
what the syntax is?

thanks


  #4  
Old November 13th, 2005, 02:44 AM
Marshall Barton
external usenet poster
 
Posts: n/a
Default How do I sum a total from multiple sub reports onto a main rep

CotoJoe wrote:
Saw your post about this and I am having the trouble you mentioned about
sub-reports having no values, therefore I am getting a #error message. Can
you tell me how I get around this?



Check the subreport's HasData property:

=IIf(subreport.Report.HasData, subreport.Report.textbox, 0)

--
Marsh
MVP [MS Access]
  #5  
Old November 13th, 2005, 06:57 AM
CotoJoe
external usenet poster
 
Posts: n/a
Default How do I sum a total from multiple sub reports onto a main rep

Dear Marsh:
Thanks very much for your post.
--
I tried this but it didn't work. Forgive me I am new to Access. I have a
main report named rptInvoice with 2 subforms, rptFloaterTrans and
rptTaxesSumProp. In the HasData section of the sub-form (not the main form
property), I typed
IIf(subreport.rptFloaterTrans.HasData, subreport.rptFloaterTrans.textbox,
0). After I exited the expression it put [] around the words "subreport" and
[rptFloaterTrans.HasData] .

Am I typing this in the right place the right way? Should I put the
expression on the main report property HasData section?

Thanks again.
--
CotoJoe


"Marshall Barton" wrote:

CotoJoe wrote:
Saw your post about this and I am having the trouble you mentioned about
sub-reports having no values, therefore I am getting a #error message. Can
you tell me how I get around this?



Check the subreport's HasData property:

=IIf(subreport.Report.HasData, subreport.Report.textbox, 0)

--
Marsh
MVP [MS Access]

  #6  
Old November 13th, 2005, 03:36 PM
Marshall Barton
external usenet poster
 
Posts: n/a
Default How do I sum a total from multiple sub reports onto a main rep

CotoJoe wrote:
I tried this but it didn't work. Forgive me I am new to Access. I have a
main report named rptInvoice with 2 subforms, rptFloaterTrans and
rptTaxesSumProp. In the HasData section of the sub-form (not the main form
property), I typed
IIf(subreport.rptFloaterTrans.HasData, subreport.rptFloaterTrans.textbox,
0). After I exited the expression it put [] around the words "subreport" and
[rptFloaterTrans.HasData] .

Am I typing this in the right place the right way? Should I put the
expression on the main report property HasData section?



There is no such thing as a HasData section so I have no
idea what you are referring to. The place to put the
expression is in a main report text box's ControlSource
property.

You seem to have misunderstood what you need to replace with
your own names. The text box's expression would be

=IIf(rptFloaterTrans.REPORT.HasData,
rptFloaterTrans.REPORT.textboxinrptFloaterTrans, 0) +
IIf(rptTaxesSumProp.REPORT.HasData,
rptTaxesSumProp.REPORT.textboxinrptTaxesSumProp, 0)

Note that the subreport names used here are the names of the
subreport **controls** on the main report. These names may
be different from the name of the report object they are
displaying.

--
Marsh
MVP [MS Access]
  #7  
Old November 14th, 2005, 08:35 PM
CotoJoe
external usenet poster
 
Posts: n/a
Default How do I sum a total from multiple sub reports onto a main rep

Marshall,

Thanks again and I mispoke. I was talking about the "On No Data" event on
the sub-report, my apologies for not being clear. I will give your coding a
try and see if I can get it right this time. Will post back my results and
again thank you very much for your help.
--
CotoJoe


"Marshall Barton" wrote:

CotoJoe wrote:
I tried this but it didn't work. Forgive me I am new to Access. I have a
main report named rptInvoice with 2 subforms, rptFloaterTrans and
rptTaxesSumProp. In the HasData section of the sub-form (not the main form
property), I typed
IIf(subreport.rptFloaterTrans.HasData, subreport.rptFloaterTrans.textbox,
0). After I exited the expression it put [] around the words "subreport" and
[rptFloaterTrans.HasData] .

Am I typing this in the right place the right way? Should I put the
expression on the main report property HasData section?



There is no such thing as a HasData section so I have no
idea what you are referring to. The place to put the
expression is in a main report text box's ControlSource
property.

You seem to have misunderstood what you need to replace with
your own names. The text box's expression would be

=IIf(rptFloaterTrans.REPORT.HasData,
rptFloaterTrans.REPORT.textboxinrptFloaterTrans, 0) +
IIf(rptTaxesSumProp.REPORT.HasData,
rptTaxesSumProp.REPORT.textboxinrptTaxesSumProp, 0)

Note that the subreport names used here are the names of the
subreport **controls** on the main report. These names may
be different from the name of the report object they are
displaying.

--
Marsh
MVP [MS Access]

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Print off multiple reports based on combo box selection jademaddy Running & Setting Up Queries 1 May 30th, 2005 08:08 PM
help needed jkendrick75 Running & Setting Up Queries 19 March 17th, 2005 02:37 PM
Grand Total Problem PW11111 Running & Setting Up Queries 2 March 11th, 2005 05:44 PM
Combine Multiple Reports to send in Email Attachment Steve General Discussion 1 June 5th, 2004 11:06 PM


All times are GMT +1. The time now is 03:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.