Referencing a Subreports field in a report

J

JohnB

Hi. If I have a report called rptReport, a Subreport
called rptSubreport and a text box called txtName in the
subreport, what would the On Format code in one of the
main reports sections be if I wanted to make the
subreport visable only if txtName had content?

Also, what would the code be if txtName was in the main
reports record source?

Is there a good on line reference for this type of thing?

Thanks for any help.

Cheers, JohnB
 
A

AlCamp

John,
I always use the "full" address to refer to a control...
Reports!rptReport!rptSubReport.Report!txtName
hth
Al Camp
 
J

JohnB

Thanks for this Al. Cheers, JohnB
-----Original Message-----
John,
I always use the "full" address to refer to a control...
Reports!rptReport!rptSubReport.Report!txtName
hth
Al Camp




.
 
J

JohnB

Hi again Al. I didnt have much time to think about your
response when I replied. Do you think the following would
work for my example? Is the syntax correct?

Thanks, JohnB

IfNot IsNull Me!Reports!rptReport!rptSubReport.Report!
txtName Then Me!rptSubReport.Report.Visable = True
Else Me!rptSubReport.Report.Visable = False
 
A

AlCamp

JohnB said:
Hi again Al. I didnt have much time to think about your
response when I replied. Do you think the following would
work for my example? Is the syntax correct?

Thanks, JohnB

IfNot IsNull Me!Reports!rptReport!rptSubReport.Report!
txtName Then Me!rptSubReport.Report.Visable = True
Else Me!rptSubReport.Report.Visable = False
 
A

AlCamp

John,
You shouldn't need the Me! designations.
Also, it's report Report.Visible... not "visable".

There's no way I can say for ceratin that your code will work. Only you
can see the actual forms and controls.
hth
Al Camp
 
J

JohnB

Thanks again Al.

The reason I thought Id need Me! is, how else does Access
know that I need the code to relate to the records being
collected to show in that particular Reports section.
Without it and without a Where statement, how does Access
know which record to go for? Or does it do that
automatically?

For example, I have the following code in a Reports
section that controls the visibility of rptSubreport
depending on the content of field txtStatus in the main
Report. I think Ive repeated it correctly here but it
does work.

If IsNot IsNull Me!txtStatus Then
Me!rptSubreport.Visible = True
Else Me!rptSubreport.Visible = False
End If

Essentially I want to modify this code so that it looks
at a text field thats in the rptSubreport records, not
the main report ones.

Cheers, JohnB
 

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