n the Report's Code Module, after the Option Explicit Statement, copy and paste the following text:
Public rKey As String
I found some code in Thread703-789560 that looks like it could solve my problem of printing multiple instances of a single report. It involves adding the following to the report module:
Public rKey as string
Private Sub Report_Close()
rCol.Remove rKey
End Sub
Then adding a separate Module, with the following code:
'''''Begin Code'''''
Public rCol As Collection, rTemp As Report
' rCol is the collection of open instances of the report
' rTemp is the temporary Report type used to add each instance to the Collection
Public Sub rpt_Multi()
"Code that produces the report"
DoCmd.OpenReport "Report1", acViewPreview
Set rTemp = New Report_Report1
rTemp.hKey = CStr(rTemp.hwnd)
rTemp.Visible = True
rCol.Add rTemp, rTemp.hKey
DoEvents
I worked this code into mine as suggested but when run I receive an "Invalid Procedure or Argument" error on the Report_Close event of the first instanc of the report.
Can anybody give me a hint as to why this is occuring?
Thanks for any help.
Eddy