user defined sub-reports..... (1 Viewer)

HimAgain

Registered User.
Local time
Today, 12:45
Joined
Sep 15, 2015
Messages
19
Hey everyone,

I need some help with making a report. I have 3 separate non related tables that need to be placed into one report. So I made a report (Let’s call it master_rpt) with three sub-reports (subA, SubB, and SubC). Each of the three sub-reports are based on a date range query that the user defines using a form (rep_date_frm). Up to this point everything works fine.

Now for the part I need help on. I would like to make it so that the user can choose to only view 1, 2, or all 3 of the sub-reports. On the “rep_date_frm” I have 3 checkboxes (subA_chk, SubB_chk, and SubC_chk). If the user only needs to see the report with SubA and SubC (Or any other combination), they would only have to place a checkmark in the checkbox.

So here is my question. What kind of vba code would I need to use to get this to work? Also, let’s say the user chose to only show “subA_rpt” and “subC_rpt”, would this leave a gap on “master_rpt” where “sub_rpt would normally be?

Let me know if you can’t make sense of what I am trying to do and I will try to clarify more.
 

Ranman256

Well-known member
Local time
Today, 13:45
Joined
Apr 9, 2015
Messages
4,337
in the REPORT ON PRINT event
Code:
subA.visible = forms!myForm!chkA.value
subB.visible = forms!myForm!chkB.value
subC.visible = forms!myForm!chkC.value

''to correct the spacing
if not subA.visible then subB.top = subA.top
if not subB.visible then subC.top = subB.top
 

MarkK

bit cruncher
Local time
Today, 10:45
Joined
Mar 17, 2004
Messages
8,180
It would be most common, I think, to set the visibility of a control in the Format event handler of the report section that contains that control.
Mark
 

Users who are viewing this thread

Top Bottom