I need to run one report a number of times.
The number of times depends on how many entries have been selected in a listbox.
The code below shows the logic, but when I run it I am only able to see one report.
Closing the report then doesn’t show the other reports which should have been run.
I know that the problem is connected with the same report being used in the docmd.openreport command but don’t know how to get round it.
I don’t NEED to really view each report – sending it direct to print would be best for me.
Any pointers as to how I can print rather than Preview? I guess this would get round the problem immediately – or not!!
Code is as follows:
For intCurrentRow = 0 To ctlSource.ListCount – 1
strwhere = “Factory = ‘” & Forms!choices!inputfactory & “‘ and date = #” & Forms!choices!inputdate & “# and ”
If ctlSource.Selected(intCurrentRow) Then
strwhere = strwhere & “Line = ‘” & ctlSource.Column(0, intCurrentRow) & “‘”
stDocName = “myreport”
DoCmd.OpenReport stDocName, acViewPreview, , strwhere
End If
Next intCurrentRow
John