Printing Reports Question

  • Thread starter Thread starter diamondgator
  • Start date Start date
D

diamondgator

I have a report (1200 pgs) that is grouped by advisor. I want to print report
but seperate it so that printer can staple each advisor's report individually.

Is there a script I can write to do this??
 
With most printers that are able to staple you would need to send each advisor
in a separate report.

IF I were attempting to do this I would write a VBA function that would call
the report multiple times (probably with a slight delay) and use the Open
report parameter that allows me to filter the records. Generically the code
might look something like the following UNTESTED code.

One problem is I have no idea how to set up the stapling, other than to set
that up in the report's page setup.

Sub sPrintAdvisorReport()
Dim vAdvisorID as Long 'Assumes that AdvisorID field is a number
Dim db as DAO.Database
Dim rs as DAO.Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset ("SELECT AdvisorID" & _
" FROM AdvisorsTable " & _
" ORDERBY AdvisorName")

Do While rs.EOF = False
DoCmd.OpenReport "MyAdvisorReport",acViewNormal,,"AdvisorID=" & vAdvisorID
DoEvents

'Insert a bit of code to pause briefly before printing the next report
Wend

End Sub


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top