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

variable SubReport & RecordSource 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I've got a problem maybe a hundred people have had before:

I want a SubReport which is variable enough to be opened by different MasterReports and each time displaying data from different charts.
So I tried to set the RecordSource of my SubReport in my MasterReport's "Report_Open" :

Me![SubReport].Report.RecordSource = "xyz"

But all I ever get is the error I tried an impossible link to the property "Form/Report".
So I tried the same thing in my SubReport:

Me.RecordSource = "xyz"

and this time (when I start the MasterReport) I get the error I could only change RecordSource in "Report_Open", where it actually IS.
So may I use my Sub´Report twice or do I have to copy it???
 
baibit,

I generally just "recreate" the record source to match what i want in the sub-report. The only 'trick' here is really no different than you would need to accomodate in your scheme anyway is that you need to maintain a common set of field names.

I usually try to set the record-source to a query and just set the query.SQL property before opening the report.

[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
I have made too many reports that had sub reports in them.
You can have mulitple main reports use the same subreport but the recordsource of the sub cannot be changed.
So what I did was open my main report double click on th e sub to open it make the cahnges to it. Then click 'File' 'SaveAs' and gave it a similar name. Now back in your main report you have to change the sub report property to look at the new sub report and then save the main report as a new main.

I have databases with 30-40 reports, but it works great.
PS we also have very FAST PC's PIII 600 with 256meg RAM [sig]<p>DougP, MCP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.[/sig]
 
So you don't think there's a chance of saving some reports??? I've had the idea of having several similar reports but it sounded a little bit too SIMPLE to me....
 
baibit,

I think you can 'save' them all - you just need to &quot;tweak&quot; the process to change the content of the record source instead of the name of.

IMHO, this is far superior to the copy/paste because it has a much lower maintenance requirement. There are simply fewer places which need to be changed when you revise a table or a report. The only downside to this is the potential for wanting to add a control/value to a subreport which is not available in the various versions of the recordsource. Even here, since I generally use a querydef and dynamically asign the SQL, I can always add the field with a dummy value and &quot;hide&quot; the control for the instance of the dummmy value.

[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top