Altering the record-source of a subreport during run-time.

lilAndy

Registered User.
Local time
Today, 03:23
Joined
Nov 27, 2002
Messages
16
I've been working on this problem for quite a while now, so any insight that anyone can offer will be gladly received.
I've looked through at most of the posts with a similar vein in them, but none seem to really address what I'm looking for.

I have a main report. In the first section is the page header.
The second section has the section header and an unbound sub-report that will contain the data that corresponds to it.
In print-preview terms, for each section header there will be a different sub-report.

I've been working on adapting the standard TOC module, so I have a "Table of Contents" table, within which are: "Section", "Description", and "Associated Table".
I haven't got my TOC module working yet, but once this bit gets rolling it shouldn't be a problem.

So, in the page layout we would have:

Page Header
Section Header (values taken from "Table of Contents")
SubForm (bound to a different form on each page)

I've tried doing this in the report's onOpen, and in the applicable sub-report's events - I generally get the same error about not being able to change the record-source once printing has began.

I would like to keep it in this sort of style if a little hack-around could be found because I want to be able to use the TOC module along with it (and this way would probably make it really easy), but as I'm still coming up with nothing if anyone else can think of an alternative solution it would really make my day.

Thanks in advance for any replies.
Andy
 
Last edited:
Setting Subreport's RecordSource

I have had the same problem and managed to solve it by using Article 210285: 'How To: Set Subreport's RecordSource Property at Run Time in Access 2000' on the Microsoft Knowledge Base website.

Hope this works OK.

Janet
 

Users who are viewing this thread

Back
Top Bottom