Adding subreports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In the main report i am adding totals from two subreports. Works fine until
one subreport dosn't exist. Viz A recipe costing program. One subreport for
base recipe and 2nd for additional ingredients. When No additional
ingredients then main report field which totals the two subreports displays
ERROR.
Any ideas ( for novice! )
 
The subreport has a HasData property.

Set the Control Source of the text box on the main form so eomthing like
this:
=IIf([MySub].[Report].[HasData], Nz([MySub].[Report].[MyTotal], 0), 0)

Replace "MySub" with the name of your subreport control, and "MyTotal" with
the name of the text box in the subreport.
 
You Beauty - Thanks.

Allen Browne said:
The subreport has a HasData property.

Set the Control Source of the text box on the main form so eomthing like
this:
=IIf([MySub].[Report].[HasData], Nz([MySub].[Report].[MyTotal], 0), 0)

Replace "MySub" with the name of your subreport control, and "MyTotal" with
the name of the text box in the subreport.

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

Reply to group, rather than allenbrowne at mvps dot org.
bdjohn said:
In the main report i am adding totals from two subreports. Works fine
until
one subreport dosn't exist. Viz A recipe costing program. One subreport
for
base recipe and 2nd for additional ingredients. When No additional
ingredients then main report field which totals the two subreports
displays
ERROR.
Any ideas ( for novice! )
 
I think I have a similar problem, but I'm a bit more of a layman. I have a
subreport that has values listed in detail and then a group footer total that
is related to the main report's grouping. I would like to create a total in
the main report that has the subreport's total and the main report's total in
the group footer. Please help me!

Allen Browne said:
The subreport has a HasData property.

Set the Control Source of the text box on the main form so eomthing like
this:
=IIf([MySub].[Report].[HasData], Nz([MySub].[Report].[MyTotal], 0), 0)

Replace "MySub" with the name of your subreport control, and "MyTotal" with
the name of the text box in the subreport.

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

Reply to group, rather than allenbrowne at mvps dot org.
bdjohn said:
In the main report i am adding totals from two subreports. Works fine
until
one subreport dosn't exist. Viz A recipe costing program. One subreport
for
base recipe and 2nd for additional ingredients. When No additional
ingredients then main report field which totals the two subreports
displays
ERROR.
Any ideas ( for novice! )
 
Just to let anyone know where I am in terms of this problem, here's the
statement I created on a control box on the group footer of my main report
(where the first statement is related to the main report's total in the same
footer, and the second statement to the subreport't total in it's footer):

=Sum([Reports]![2005 CSALE Mrkt Segments]![Text195])+Sum([Reports]![2005
Alloc CSALE subreport1]![Text48])

If anyone can help me, please e-mail me directly at
(e-mail address removed) (remove the nospam.). I'd love to ge tthis solved
today and would love to talk to someone about it.

NoChrono said:
I think I have a similar problem, but I'm a bit more of a layman. I have a
subreport that has values listed in detail and then a group footer total that
is related to the main report's grouping. I would like to create a total in
the main report that has the subreport's total and the main report's total in
the group footer. Please help me!

Allen Browne said:
The subreport has a HasData property.

Set the Control Source of the text box on the main form so eomthing like
this:
=IIf([MySub].[Report].[HasData], Nz([MySub].[Report].[MyTotal], 0), 0)

Replace "MySub" with the name of your subreport control, and "MyTotal" with
the name of the text box in the subreport.

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

Reply to group, rather than allenbrowne at mvps dot org.
bdjohn said:
In the main report i am adding totals from two subreports. Works fine
until
one subreport dosn't exist. Viz A recipe costing program. One subreport
for
base recipe and 2nd for additional ingredients. When No additional
ingredients then main report field which totals the two subreports
displays
ERROR.
Any ideas ( for novice! )
 
You are passing the value from a subreport back to the main report, and
showing it in the group footer. Then at the end of the report, you want the
sum of all the subreport totals?

Without testing it, you should be able to do it with Running Sum.

In the group footer, you already have a text box with properties like this:
Name txtSubTotal
Format Currency
Control Source =IIf([MySub].[Report].[HasData],
Nz([MySub].[Report].[MyTotal], 0), 0)

Now add another text box with these properties:
Name txtSubTotalRS
Format Currency
Control Source =[txtSubTotal]
Running Sum Over All

This text box should progressively increment each time the subreport
subtotal shows up, and you should then have the total by the time you reach
the end of the report.

Post back if that does not work for you.

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

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

NoChrono said:
I think I have a similar problem, but I'm a bit more of a layman. I have a
subreport that has values listed in detail and then a group footer total
that
is related to the main report's grouping. I would like to create a total
in
the main report that has the subreport's total and the main report's total
in
the group footer. Please help me!

Allen Browne said:
The subreport has a HasData property.

Set the Control Source of the text box on the main form so eomthing like
this:
=IIf([MySub].[Report].[HasData], Nz([MySub].[Report].[MyTotal], 0), 0)

Replace "MySub" with the name of your subreport control, and "MyTotal"
with
the name of the text box in the subreport.
 
Thank you for the very prompt response. I don't quite understand how to
implement that IIf statement...I should add that there are actually 13 totals
in each report that I would like to combine, they are numbered by date
Sum([1]), Sum([2]), etc. My previous post shows you a general look of the
layout of my report. Could I trouble you to possibly break it down a bit
more? The access knowledge I have accumulated thus far has pretty much only
originated from applying concepts I've seen in practice elsewhere. Please
let me know if you need any more information.

Allen Browne said:
You are passing the value from a subreport back to the main report, and
showing it in the group footer. Then at the end of the report, you want the
sum of all the subreport totals?

Without testing it, you should be able to do it with Running Sum.

In the group footer, you already have a text box with properties like this:
Name txtSubTotal
Format Currency
Control Source =IIf([MySub].[Report].[HasData],
Nz([MySub].[Report].[MyTotal], 0), 0)

Now add another text box with these properties:
Name txtSubTotalRS
Format Currency
Control Source =[txtSubTotal]
Running Sum Over All

This text box should progressively increment each time the subreport
subtotal shows up, and you should then have the total by the time you reach
the end of the report.

Post back if that does not work for you.

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

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

NoChrono said:
I think I have a similar problem, but I'm a bit more of a layman. I have a
subreport that has values listed in detail and then a group footer total
that
is related to the main report's grouping. I would like to create a total
in
the main report that has the subreport's total and the main report's total
in
the group footer. Please help me!

Allen Browne said:
The subreport has a HasData property.

Set the Control Source of the text box on the main form so eomthing like
this:
=IIf([MySub].[Report].[HasData], Nz([MySub].[Report].[MyTotal], 0), 0)

Replace "MySub" with the name of your subreport control, and "MyTotal"
with
the name of the text box in the subreport.
 
Wait a tick...there we go.

You sir, are a beautiful, beautiful man. If I was a woman, I'd have your
babies. THANK YOU SOOOO MUCH!

Allen Browne said:
You are passing the value from a subreport back to the main report, and
showing it in the group footer. Then at the end of the report, you want the
sum of all the subreport totals?

Without testing it, you should be able to do it with Running Sum.

In the group footer, you already have a text box with properties like this:
Name txtSubTotal
Format Currency
Control Source =IIf([MySub].[Report].[HasData],
Nz([MySub].[Report].[MyTotal], 0), 0)

Now add another text box with these properties:
Name txtSubTotalRS
Format Currency
Control Source =[txtSubTotal]
Running Sum Over All

This text box should progressively increment each time the subreport
subtotal shows up, and you should then have the total by the time you reach
the end of the report.

Post back if that does not work for you.

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

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

NoChrono said:
I think I have a similar problem, but I'm a bit more of a layman. I have a
subreport that has values listed in detail and then a group footer total
that
is related to the main report's grouping. I would like to create a total
in
the main report that has the subreport's total and the main report's total
in
the group footer. Please help me!

Allen Browne said:
The subreport has a HasData property.

Set the Control Source of the text box on the main form so eomthing like
this:
=IIf([MySub].[Report].[HasData], Nz([MySub].[Report].[MyTotal], 0), 0)

Replace "MySub" with the name of your subreport control, and "MyTotal"
with
the name of the text box in the subreport.
 
OK, Allen, what've got say to that thankyou?? ;-)

Definitely a different way of expressing appreciation that
the problem is solved.

I love it,
--
Marsh
MVP [MS Access]

Wait a tick...there we go.

You sir, are a beautiful, beautiful man. If I was a woman, I'd have your
babies. THANK YOU SOOOO MUCH!

"Allen Browne" wrote:
[snip the answer]
 
Thank you for your effusive expression of appreciation.

However, under the circumstances (me married to loveliest woman on planet,
you male), I think I will pass (out) on that offer. :-)

Seriously though, it is always good to know that you are now able to do what
you need to.

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

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

Marshall Barton said:
OK, Allen, what've got say to that thankyou?? ;-)

Definitely a different way of expressing appreciation that
the problem is solved.

I love it,
--
Marsh
MVP [MS Access]

Wait a tick...there we go.

You sir, are a beautiful, beautiful man. If I was a woman, I'd have your
babies. THANK YOU SOOOO MUCH!

"Allen Browne" wrote:
[snip the answer]
 
Mr. Browne,

Once again your clarity and straightforwardness have helped me to understand
another layer of the Access Onion. Thank you!

Jaybird

Allen Browne said:
The subreport has a HasData property.

Set the Control Source of the text box on the main form so eomthing like
this:
=IIf([MySub].[Report].[HasData], Nz([MySub].[Report].[MyTotal], 0), 0)

Replace "MySub" with the name of your subreport control, and "MyTotal" with
the name of the text box in the subreport.

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

Reply to group, rather than allenbrowne at mvps dot org.
bdjohn said:
In the main report i am adding totals from two subreports. Works fine
until
one subreport dosn't exist. Viz A recipe costing program. One subreport
for
base recipe and 2nd for additional ingredients. When No additional
ingredients then main report field which totals the two subreports
displays
ERROR.
Any ideas ( for novice! )
 

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

Back
Top