Working With Sub-Reports

J

Junior

Hello!

I have a report that I would like to fine tune, and I was hoping
someone could help me.
There is a field in this report - let's call it TC_CST, derived from
an underlying sql statement. Based on the value of this field, I
would like to be able to set properties to a series of sub-reports to
visible or not visble. For example,

If TC_CST = "x", then make sub_report_1 visible
If TC_CST = "y", then make sub_report_2 visible
and so on...........................

I am not exaclty sure where I need to insert code to instruct the main
report to complete this action. Is it placed in the OnOpen or the
OnActivate??

Also, what would be the correct syntax to accomplish this?
 
M

Marshall Barton

Junior said:
I have a report that I would like to fine tune, and I was hoping
someone could help me.
There is a field in this report - let's call it TC_CST, derived from
an underlying sql statement. Based on the value of this field, I
would like to be able to set properties to a series of sub-reports to
visible or not visble. For example,

If TC_CST = "x", then make sub_report_1 visible
If TC_CST = "y", then make sub_report_2 visible
and so on...........................

I am not exaclty sure where I need to insert code to instruct the main
report to complete this action. Is it placed in the OnOpen or the
OnActivate??

Also, what would be the correct syntax to accomplish this?


Neither place. The code belongs in the Format event
procedure of the section that contains the subreports:

Me.subreport_1.Visible = (TC_CST = "x")
Me.subreport_2.Visible = (TC_CST = "y")
. . .

This situation smells just a little fishy. Are you sure you
really have so many **different** subreports?
 
J

Junior

Junior said:
I have a report that I would like to fine tune, and I was hoping
someone could help me.
There is a field in this report - let's call it TC_CST, derived from
an underlying sql statement. Based on the value of this field, I
would like to be able to set properties to a series of sub-reports to
visible or not visble. For example,
If TC_CST = "x", then make sub_report_1 visible
If TC_CST = "y", then make sub_report_2 visible
and so on...........................
I am not exaclty sure where I need to insert code to instruct the main
report to complete this action. Is it placed in the OnOpen or the
OnActivate??
Also, what would be the correct syntax to accomplish this?

Neither place. The code belongs in the Format event
procedure of the section that contains the subreports:

Me.subreport_1.Visible = (TC_CST = "x")
Me.subreport_2.Visible = (TC_CST = "y")
. . .

This situation smells just a little fishy. Are you sure you
really have so many **different** subreports?

--
Marsh
MVP [MS Access]- Hide quoted text -

- Show quoted text -

Thanks for the help. I'll give it a shot.
At the moment, I actually have 2 sub-reports.
 

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