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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform recordsource procedure??? 1

Status
Not open for further replies.

RemyS

Technical User
Jul 3, 2001
100
GB
Hi all,

I've produced a simple reporting application based on date specific data. To improve daily querying speeds I've created two versions of each table (Daily, and Archived). There are 4 tables in total.

The main report has code in the Report_Open event to determine whether it's record source will come from the Daily table or the Archive table.
No problems there.

However I'm having trouble getting the subreport to do the same.

I have tried the following already:
In the Report_Open event: Me.AREPORT_subreport.Report.RecordSource = strSQL
Error: Expression has an invalid reference to the property Form/Report

In the subreport_Open event: Me.RecordSource = strSQL
Error: Can't set the RecordSource property after printing has started

Setting Subreport recordsource before opening the main report:
Error: Can't find AREPORT_subreport (i.e. not open)


Can anyone swing some other suggestions my way, or a correct sollution to this.

All help much appreciated.
remy Still new to DB's and enjoying learning day by day
 
Did anyone have ny joy with this? I've got a similiar query today..I want to change the recordsource of a subreport, based on the value of a checkbox. Any help much appreciated!
 
I have a similar problem running in another
thread:
thread703-552206 solution didn't work for me because
my subreport has things going on with
it such as code in the mainrpt's detail
to reference a footer texbox in the
subreport, but if your subform is simple
enough, this might work:

Good luck, and let's all keep each other
posted should anyone solve this.

-g
 
Woohoo! I just wasn't thinking about the subreports OnOpen event being called more than once, so the instructions on MS website to not attempt to change the recordsource after the first time, worked perfectly for me.

Thanks! This has been taking over my job for a few days, and given me a better insight into how things work.

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top