Call Multiple Subreports in Report and pass data (1 Viewer)

rkaptu

Registered User.
Local time
Yesterday, 16:47
Joined
Oct 27, 2017
Messages
19
Hi

I need to do a report showing a schedule for a whole week. Each day's schedule is calculated in the same and so I thought of creating a subreport and calling it 7 times from the main report. I have include 7 subreport controls in the main report and called them SR1, SR2,.....SR7.

I am managing to call the subreports by using:

Me.Controls("SR" & i).SourceObject = "Detailed_Subreport"

In the Open event of the main report. Question is how can I make each instance of the subreport behave differently (i.e. generate the schedule for the respective day of the week).

The subreport is getting the starting date of the week from a label in the header of the main report. So all I need is to have an integer from 0 to 6 passed to each of the 7 subreports so that each one generates the schedule of the different day. How can I do it?

Can I, in the subreport, get the name of the control that called it in the main form?

Thanks
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:47
Joined
May 7, 2009
Messages
19,230
instead of label on main report, make it
a textbox. place 7 of them (text1, text2, text3,....text7)

now place an expression on each textbox's
Control Source, ie:

text1 controlsource =Date()
text2 controlsource =Date()+1
...
text7 controlsource =Date()+7

now on you subreport1
on its Property->Data
Link Master fields: text1
Link Child Fields: [theDateFieldInSubreport1]

subreport2:
Link Master Fields: text2
Link Child Fields: [theDateFieldInSubreport2]
...
...
and so on

if you want to keep the label on the main report keep it.
if you must hide the text box on main firm set their visible proprty to no.
 

Users who are viewing this thread

Top Bottom