Reference MainReport Control in Subreport

  • Thread starter Thread starter blinton25
  • Start date Start date
B

blinton25

Hello,

I have a main report (TestReport) in which there is a sub-
report (testSubReport). I wish to reference a control in
the main report, which I try to do by using:

=[Reports]![TestReport]![Text102]

However when I do this Access crashes. Am I doing
something incorrectly?

BrianL
 
From the main report, you need to refer to:
- the name of the subreport control;
- the Report in that control;
- the text box on the subreport.

That means:
=[testSubReport].[Report].[Text102]

Note that if the subreport has no data, that will produce #Error. To show a
zero if there is no data, or if the data is null, try:
=IIf([testSubReport].[Report].[HasData],
Nz([testSubReport].[Report].[Text102], 0), 0)
 
Hello,

Well just a note that I wanted to reference a control on
the main report from the subreport. I tried my origonal
code on another machine, but using your . operator rather
than ! and it worked.
-----Original Message-----
From the main report, you need to refer to:
- the name of the subreport control;
- the Report in that control;
- the text box on the subreport.

That means:
=[testSubReport].[Report].[Text102]

Note that if the subreport has no data, that will produce #Error. To show a
zero if there is no data, or if the data is null, try:
=IIf([testSubReport].[Report].[HasData],
Nz([testSubReport].[Report].[Text102], 0), 0)

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

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

blinton25 said:
I have a main report (TestReport) in which there is a sub-
report (testSubReport). I wish to reference a control in
the main report, which I try to do by using:

=[Reports]![TestReport]![Text102]

However when I do this Access crashes. Am I doing
something incorrectly?

BrianL


.
 
Back
Top