Report.SourceObject Issue

Denarien

New member
Local time
Yesterday, 20:04
Joined
May 6, 2015
Messages
5
I have stumbled across an issue in my report involving the Report.SourceObject property. The section of the report contains a subreport that needs to change dynamically to display the report that relates to the corresponding test. When trying to change the subreports.Sourceobject property I get the error “Run-time error ‘2191’: You can’t set the Source Object Property in the print preview or after printing has started. ” This is very clear to me what the limitation is, however I was wondering if there was some way around this.

I have currently tried creating multiple subreports that are stacked on each other with visible property set to false. Then I change the specific subreport visible property base of a select. This worked, but was extremely hard on the machine and printer as there is about 15 different possible subreports.

Secondly I have tried exporting it to RTF and just manually copying and pasting the tables. The down side with this is all the formatting and work I have put into the report as a whole goes out the window so if possible would like to avoid this situation as well.

Any help or suggestions to guide me in the right direction would be greatly appreciated.

Cheers,
Mike
 
what is your desired output format - pdf, word, excel?
 
The desired output if i can figure out the table issue would be fine as pdf. Either way word works as well going to try and avoid rtf.
 
That was a very informative post and I have marked it as a favorite for future reference. Although it was not entirely what I was looking for. If I was to go that method I would need to completely rebuild my report through vba which I would like to avoid if possible. Since the report loops through at minimum 100 and some odd records. I understand there is not many work arounds for changing a reports.Sourceobject during runtime, but if one can be found so I can add the table into the report at the specified location and related to the current record it would be my desired approach.
 
I probably can't offer much more at this point.

Only alternate way I can think of is to use the same table. meaning it launches - inserts whatever information desired into one temporary table that is later used as the source of the report.
 
I very much appreciate your help and I will look into reconstructing the sub to work in that manner and see if it works out.
 
So I have tried to use the temporary table but it was still just refusing to work. I have no gone on to use the link you provided as a resource. I was wondering however if you know of a way of inserting an object itself such as an already created report instead of just text.

Cheers,
Mike
 
With forms you could leave the source object of a subform empty and then fx set it in the OnOpen of the main form. Try it with your report and subreport.
 

Users who are viewing this thread

Back
Top Bottom