I have a single report that the user would like to preview for multiple clients. I have run into this situation before and with the help of EE realized that to preview mulitple versions of the same report at the same time I have to create a new instance of the report for each preview.
The logic looks like this now:
Dim reportInstance As String ' done so mulitple yield reports can be shown
reportInstance = getNextYieldReportInstance
DoCmd.OpenReport reportInstance, acViewPreview, , , , oArgs
The instance is created using the routine in the code window.
I also have a routine to clean up all of the temorary instances
I am working on a similar conept for another client and handled it exactly the same way but it's not working. When the logic that generates the multiple previews is complete only the last report generates is previewed. I verified that all of the instance are being created correctly and you can see the correct previews on the screen as the report for each cuatomer is generated. HOwever, at conclusion only the last report is avaialble for preview.
One difference between the reports is that the firts report I tried this with had no subreports and the new one that isn't working has two subreports. I wanted to test this and can easily generate new instances of the subreports as I generate the new instance of the main report. However, I don't know how to use code to revise the the new instance of the main report to use the new instances of the subreports ratehr than the originals.
I would appreciate any code showig how to revise the new isnatnce of the main report to use the two new insatnces of the supreports. Or another suggestion as to how to preview multiple reports (with a subreport).
The main report name is
'wkRecap Rpt_Driver' and subreports are:
'subbrptWkRecp_1' and 'subReportWkRecap_2'
The reprot names in the coding example are from my old application, not the new one.
Public Function getNextYieldReportInstance() As String
gNumYieldReports = gNumYieldReports + 1
Dim newName As String
newName = cTempReportPrefix & "rptYieldReport" & Trim(Str(gNumYieldReports))
DoCmd.CopyObject , newName, acReport, "rptYieldReport"
getNextYieldReportInstance = newName