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
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