Dynamic RecordSource in subform/subreport

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

I have a master Report that outputs various
subreports/subforms on single summary page for
each 'DealKey'.

For each 'DealKey', a unique form is generated via code
and named: frm[DealKey], or frm3107, frm3108, etc.

Every time I try to change the Source Object of an
unbound subform on my Report in the Detail_OnFormat
Event, I get a 'Run-time error 2191, cannot set the
Source Object property after printing has started.

I need this to happen for each record in the Master
report's record source, and it must happen dynamically.

Any assistance would be greatly appreciated.

Michael
 
Michael said:
I have a master Report that outputs various
subreports/subforms on single summary page for
each 'DealKey'.

For each 'DealKey', a unique form is generated via code
and named: frm[DealKey], or frm3107, frm3108, etc.

Every time I try to change the Source Object of an
unbound subform on my Report in the Detail_OnFormat
Event, I get a 'Run-time error 2191, cannot set the
Source Object property after printing has started.

I need this to happen for each record in the Master
report's record source, and it must happen dynamically.


What you're asking for is not going to happen, that kind of
thing is one of the relatively few limitations of reports.
You need to back up and consider some kind of alternative
approach.

First issue is to avoid creating heavy duty objects
(forms/reports) on the fly at run time. This is a dangerous
activity that should only be performed at design time when
you can keep adequate backups and quickly perform recovery
procedures as soon as you realize that things are going
south.

Another issue to avoid is using forms to print data. They
are just not intended for this purpose and, sooner or later,
will run into problems. Subreports are more appropriate.

Reports have many features that provide a lot of
flexibility. If you'll explain more about what you're
trying to accomplish, it's likely that some good suggestions
will be provided by the participants in these newsgroups.
 
Back
Top