Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the Recordsource of a Subreport

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
US
Whats the syntax to set the recordsource of subreport

My Report name is: rptPRRunReportHist
My subreport name is: rptPRRunEmployeeTax1
 
From where, the Parent report, or a Standard Module?


Report Class Module;
Me.rptPRRunEmployeeTax1.Report.Recordsource = "SELECT..."

Standard Module
Reports!rptPRRunReportHist!rptPRRunEmployeeTax1.Report.Recordsource = "SELECT...
 
I would like to run it when I open the parent report.

I copied your code and tried doing both ways and I get a run-time error 2455.

"You entered an expression that has an invalid reference to the property Form/Report.
 
If it is not possible to set the recordsource of a subreport once the parent report is open. Can I run code prior to opening the parent report so that the subreports will have the correct data in the table they are querying?
 
Is there a way how to run the code on the subreport before the parent report.
 
This was done from a standard module

DoCmd.OpenReport "Report1", acViewDesign, , , acHidden
Reports!Report1!.RecordSource = "tblUser"
Reports!Report1!Child0.Report.RecordSource = "tblUserPhone"
DoCmd.OpenReport "Report1", acViewPreview, , , acWindowNormal
 
So just to understand the only way to do it. Is by opening in Design View. Otherwise I gather it would not be possible to set the recordsource once the parent report is open.
 
I don't believe so, even with forms, one can only manipulate
the recordsource in design view.
The filter & OrderBy property though, can be done from
normal view.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top