Selecting sub-report(s) based on criteria

A

Alp Bekisoglu

Hi Experts,

What would be the way to have a report select its sub(s) dynamicly at
runtime?

I have a report consisting of 8 sub-reports which some also have sub(s) of
their own. Based on the year the report is being printed, there are some
design changes at certain locations on some pages. I would like to
incorporate this into the main report and/or the sub-report (most probably
via code) hopefully without bloating my FrontEnd. The main criteria here
would be the year. So in a nutshell:
If the year is 2000 then the report's subs are SubA-1, SubB-1, SubC-1....
where SubC-1 consists of cA1 & cA2
If the year is 2002 then the report's subs are SubA-1, SubB-3, SubC-3....
where SubC-3 consists of cC1 & cC2

Is this possible?
Could the reports be grouped in an external database just for the sake of
avoiding the swelling-up of the front end?

Thanks in advance,

Alp
 
M

Marshall Barton

Alp said:
What would be the way to have a report select its sub(s) dynamicly at
runtime?

I have a report consisting of 8 sub-reports which some also have sub(s) of
their own. Based on the year the report is being printed, there are some
design changes at certain locations on some pages. I would like to
incorporate this into the main report and/or the sub-report (most probably
via code) hopefully without bloating my FrontEnd. The main criteria here
would be the year. So in a nutshell:
If the year is 2000 then the report's subs are SubA-1, SubB-1, SubC-1....
where SubC-1 consists of cA1 & cA2
If the year is 2002 then the report's subs are SubA-1, SubB-3, SubC-3....
where SubC-3 consists of cC1 & cC2

Is this possible?
Could the reports be grouped in an external database just for the sake of
avoiding the swelling-up of the front end?


You should not be making design changes at run time. Even
aside from the massive bloat issue, there is a greatly
increased chance of corruption.

A better approach is to modify the properties of the
controls in a single report to change the appearance of the
report.

Even if you can't figure out a way to do that, there's
always the heavy handed approach of having both subreport's
in the same main report and making whichever one you want to
see visible and the other invisible.

If you explained what's different about subreports B1 and
B3, maybe someone will be able to figure out a way to do it
in a single subreport.
 
A

Alp Bekisoglu

Hi Marsh,

Thanks for your reply. The differences are some new fields have to be added
and some are removed from some sections of the report, when we think of it
as a whole. Reprot B is the main holder of all the 8 pages (subs) and does
have the year as the master/child relation to all of its subs.
Page 2 (sub) is a single page report and for this year one field is out, a
new one is in thus the calculation has changed as well. But the layout is
(except for say a relocation of a field place) the same.
Page 3 (sub) comprises of 4 sub-reports in which one has new fields this
year.
etc...
My aim (or desire) is the application to be able to pick the correct Page in
relation to the user selected year. I will still have all the relevant
sub-sub-reports available within my FE fo the code to include the correct
(according to the year) one on the page. For instance regarding page3, all
the sub-reports (say named as 3a, 3b, 3c and 3d) is in the application where
now there will be a 3b1. Intended result is when the report is called, page
3 (via code) should include 3a, 3b1 (if for 2003 but 3b if else), 3c and 3d
while loading.
As an example for 3b/3b1:
label field
item1 field1
item2 field2
item3 field3
for this year:
item1 field1
item2 field2
item3 field3
item4 field4
item5 field5
item6 field6
I don't think it is a good practice to attach copy of the report/full class
in the NG since I have not seen attachments.
The logic seems pretty simple to me but maybe I'm looking at it from a wrong
point.

Alp
 
M

Marshall Barton

Alp said:
Hi Marsh,

Thanks for your reply. The differences are some new fields have to be added
and some are removed from some sections of the report, when we think of it
as a whole. Reprot B is the main holder of all the 8 pages (subs) and does
have the year as the master/child relation to all of its subs.
Page 2 (sub) is a single page report and for this year one field is out, a
new one is in thus the calculation has changed as well. But the layout is
(except for say a relocation of a field place) the same.
Page 3 (sub) comprises of 4 sub-reports in which one has new fields this
year.
etc...
My aim (or desire) is the application to be able to pick the correct Page in
relation to the user selected year. I will still have all the relevant
sub-sub-reports available within my FE fo the code to include the correct
(according to the year) one on the page. For instance regarding page3, all
the sub-reports (say named as 3a, 3b, 3c and 3d) is in the application where
now there will be a 3b1. Intended result is when the report is called, page
3 (via code) should include 3a, 3b1 (if for 2003 but 3b if else), 3c and 3d
while loading.
As an example for 3b/3b1:
label field
item1 field1
item2 field2
item3 field3
for this year:
item1 field1
item2 field2
item3 field3
item4 field4
item5 field5
item6 field6
I don't think it is a good practice to attach copy of the report/full class
in the NG since I have not seen attachments.
The logic seems pretty simple to me but maybe I'm looking at it from a wrong
point.


Either you have gone off down the wrong road or I am even
more confused now. I have no idea what you're referring to
with your "page 3", etc. designations.

If I ignore all that and just address the issue of sometimes
showing 3 fields in a subreport and other times showing 6
fields, then why can't you just use the subreport's
detail(?) section's Format event to make some of the fields
visible or not depending on the year.

Me.field4.Visible = (Yearfield = 2003)
Me.field5.Visible = (Yearfield = 2003)
Me.field6.Visible = (Yearfield = 2003)

And set those 3 field's and the detail section's CanShrink
property to Yes.
--
Marsh
MVP [MS Access]


 

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