R
Reggie
Hi and TIA. I have a form where the user can select multiple records that
they want printed. When they clcik print I would like the preview window to
open for the first record so they can view it and or change printer options.
Once done and they close the report I would like it to automaticly move to
the next record and open the preview window again and continue till the end
of the recordset. If I dont preview the records and send them directly to
the printer they all print seperatly and it works fine, however when I use
the preview method my code simply loops thru to the last record then opens
the preview window. What I'm doing is setting a global variable for the ID
of the current record and my queries that calculate the values for my report
then retrieve the variable. Below is what I'm trying. The other reason I
have to do this is because some values in my group header are calculated on
the fly for each record so I must iterate throught the record, calculate and
print, then move to the next etc. Any advice would be apprecited. Thanks
again
stDocName = "rptReqs_Print"
Set db = CurrentDb()
Set rst = db.OpenRecordset("qryReq_Print", dbOpenDynaset)
If AreThereRecords(rst) Then
rst.MoveFirst
Do Until rst.EOF
plngOSID = rst![OS_ID] 'Current record ID
Call SetOSID(plngOSID) 'Set global variable
Set db2 = CurrentDb()
Set rst2 = db.OpenRecordset(stQuery, dbOpenDynaset)
If AreThereRecords(rst2) Then
DoCmd.OpenReport stDocName, acViewPreview
End If
rst.MoveNext
Loop
End If
they want printed. When they clcik print I would like the preview window to
open for the first record so they can view it and or change printer options.
Once done and they close the report I would like it to automaticly move to
the next record and open the preview window again and continue till the end
of the recordset. If I dont preview the records and send them directly to
the printer they all print seperatly and it works fine, however when I use
the preview method my code simply loops thru to the last record then opens
the preview window. What I'm doing is setting a global variable for the ID
of the current record and my queries that calculate the values for my report
then retrieve the variable. Below is what I'm trying. The other reason I
have to do this is because some values in my group header are calculated on
the fly for each record so I must iterate throught the record, calculate and
print, then move to the next etc. Any advice would be apprecited. Thanks
again
stDocName = "rptReqs_Print"
Set db = CurrentDb()
Set rst = db.OpenRecordset("qryReq_Print", dbOpenDynaset)
If AreThereRecords(rst) Then
rst.MoveFirst
Do Until rst.EOF
plngOSID = rst![OS_ID] 'Current record ID
Call SetOSID(plngOSID) 'Set global variable
Set db2 = CurrentDb()
Set rst2 = db.OpenRecordset(stQuery, dbOpenDynaset)
If AreThereRecords(rst2) Then
DoCmd.OpenReport stDocName, acViewPreview
End If
rst.MoveNext
Loop
End If