Reference a field on a subreport

W

Wez.k

Hello

I have a report called "Schools costing report" which contains a subreport
called "TempSchoolB_SubReport".

I would like to transfer the value of a subreport field called "Text12" to a
field on the main report called "Text188"

I have searched the help files and this forum but nothing seems to work for
me. Any help would be greatly appreciated.

Wez.k
 
A

Allen Browne

If the text box in the subreport is in the Detail Section, it repeats for
every record, so (from the main report's point of view) there is no such
thing as the value of the (one) value of the text box in the subreport.

If you put the text box into the Report Footer of the subreport, there is a
single total for the subreport, and so you can refer to it in the main
report. See:
Bring the total from a subreport onto a main report
at:
http://allenbrowne.com/casu-18.html
 
W

Wez.k

Thanks Allen thats most helpful. It seems that I fell into that trap
regarding the name of a subreport being different to what one would assume...

I now have my control on the main report successfully displaying the value
from the control on the subreport - but only if the main report extends out
to two pages (the control is in the Report Footer). If I arrange the
controls so they all appear on the first page,
by putting them closer together, the control is blank (it does not display
"#Error")

Any idea why this is happening?

Wez.k
 
A

Allen Browne

That's strange.

Only if the main report spreads onto 2 pages, then its text box successfully
shows the value from the subreport?

What's the Control Source of the text box?
And what is its Name?
 
W

Wez.k

The name of the control is "Text188"
and its data source is "=[TempSchoolB Query].[Report].[Text16]"

Wez.k
 
W

Wez.k

Sorry Allen, I shouild have mentioned that the page always breaks immediately
before the subreport, never anywhere else

Wez.k
 
A

Allen Browne

I can't see anything wrong with that, Wez.

Given that it works in some cases, I have to assume that the problem is
elsewhere than the ControlSource of this text box.

Calculated controls have dependencies that Access has to resolve in order to
get the result. As it calculates them, if it finds one that cannot be solved
for any reason, it just gives up and does not even try to calculate the
others. You can therefore end up with #Error in a control, when the error is
actually caused by a different one.

My guess is therefore that some other control on the main report or in the
subreport is the cause of the error.

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

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

Wez.k said:
The name of the control is "Text188"
and its data source is "=[TempSchoolB Query].[Report].[Text16]"

Wez.k

Wez.k said:
Thanks Allen thats most helpful. It seems that I fell into that trap
regarding the name of a subreport being different to what one would
assume...

I now have my control on the main report successfully displaying the
value
from the control on the subreport - but only if the main report extends
out
to two pages (the control is in the Report Footer). If I arrange the
controls so they all appear on the first page,
by putting them closer together, the control is blank (it does not
display
"#Error")

Any idea why this is happening?

Wez.k
 
W

Wez.k

OK thanks Allen, I'll persevere...

Wez

Allen Browne said:
I can't see anything wrong with that, Wez.

Given that it works in some cases, I have to assume that the problem is
elsewhere than the ControlSource of this text box.

Calculated controls have dependencies that Access has to resolve in order to
get the result. As it calculates them, if it finds one that cannot be solved
for any reason, it just gives up and does not even try to calculate the
others. You can therefore end up with #Error in a control, when the error is
actually caused by a different one.

My guess is therefore that some other control on the main report or in the
subreport is the cause of the error.

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

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

Wez.k said:
The name of the control is "Text188"
and its data source is "=[TempSchoolB Query].[Report].[Text16]"

Wez.k

Wez.k said:
Thanks Allen thats most helpful. It seems that I fell into that trap
regarding the name of a subreport being different to what one would
assume...

I now have my control on the main report successfully displaying the
value
from the control on the subreport - but only if the main report extends
out
to two pages (the control is in the Report Footer). If I arrange the
controls so they all appear on the first page,
by putting them closer together, the control is blank (it does not
display
"#Error")

Any idea why this is happening?

Wez.k

:

If the text box in the subreport is in the Detail Section, it repeats
for
every record, so (from the main report's point of view) there is no
such
thing as the value of the (one) value of the text box in the subreport.

If you put the text box into the Report Footer of the subreport, there
is a
single total for the subreport, and so you can refer to it in the main
report. See:
Bring the total from a subreport onto a main report
at:
http://allenbrowne.com/casu-18.html


I have a report called "Schools costing report" which contains a
subreport
called "TempSchoolB_SubReport".

I would like to transfer the value of a subreport field called
"Text12" to
a
field on the main report called "Text188"

I have searched the help files and this forum but nothing seems to
work
for
me. Any help would be greatly appreciated.
 

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

Similar Threads


Top