printing Report one after another by code

  • Thread starter Thread starter Axel Seutemann
  • Start date Start date
A

Axel Seutemann

Hi there,

I want to print/preview Reports one after another, after closing the report,
the next should be visible. I have a loop, but after opening the report, the
code stops. I think I have to put some more code for the
Report-Close-Event?!

I don't know how to solve my problem

Does someone has the answer?

Private Sub btnPrn1_Click()
Dim stDocName As String
Dim dbs As Database
Dim rst As New ADODB.Recordset
Dim strLinkCrit As String
Dim txtBehPlNr As String



Set dbs = CurrentDb

'öffne Recordset Status nicht gedruckt

rst.Open "Select BEH_PL_NR, PAT_CODE, BEH_PL_SUM_ALL, BEH_PL_STATUS from
T_BEH_PL where BEH_PL_STATUS = 2 and BEH_PL_SUM_ALL >0", _
ActiveConnection:=CurrentProject.Connection, _
CursorType:=adOpenKeyset, _
LockType:=adLockOptimistic

'Bis zum ende laufen
Do While Not rst.EOF
'Rechnungsnummer extrahieren
txtBehPlNr = rst!BEH_PL_NR
'strLinkCrit = "[BEH_PL_NR] = " + " '" + (txtBehPlNr) + "'"
strLinkCrit = "BEH_PL_NR = " & "'" & txtBehPlNr & "'"


DoCmd.OpenReport "rptNew", acViewPreview, , strLinkCrit


'Debug.Print txtBehPlNr

rst.MoveNext
Loop

'End If
rst.Close
Set rst = Nothing
'End If
End Sub

Thank in advance
A. Seutemann
 
What I have done previously is I created a print button on
a form and this one print button opend several reports in
preview, than I could just from the top viw/print reports
and I closed each I had decided. It sure beats having to
clikc 6 or seven buttons just to view reports before
printing.
Hope this helps.
Fons
 
Back
Top