The reason why you receive the error is that Access is probably firing the
Open event of the subreport twice.
The first occurance fires *before* the main report opens, so any attempt to
reference anything in the main report fails.
The second occurance fires after the report is already in progress (as
non-sensical as that sounds), and so attempts to assign the recordsource in
this 2nd instance of Report_Open fails.
If what you are trying to do is independent of the main report, you may find
that the 1st occurance achieves what you need, and so you can tell your
error handler to ignore the error caused by the 2nd occurance.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
ctdak said:
I have a report with two embedded subreports. The main report has the
recordsource set in VB code of the on open event. If I define the
recordsource for the two subreports using a query-designer query, all is
well. But if I try to set either subreport recordsource in VB code of the
on open event, I get an error when I move between pages of the report saying
"You can't set the RecordSource property after printing has started." Why
am I getting this error?