Printing separate reports out of one main report

E

Eva

Hi
I have a querry where I have number of customers
Then I have a report with data for all of them
I would like to print out separate PDF files for all customers.
(I have set up Adobe PDF as the printer there)

How to do it?
 
D

Dale Fye

Eva,

You will have to setup a loop which you can use to restrict the records that
are displayed in the report at any particular time. Are you actually going
to print out the PDFs, or do you want to send them via the SendObject method?

Assuming the query that is used for the report is qry_Report, and that this
query contains the customerID field, you could do something like the
following in the click event of a command button:

Private Sub cmd_Report_Click

Dim strSQL as string, strCriteria as string
Dim rs as DAO.Recordset

strSQL = "SELECT DISTINCT CustomerID FROM qry_Reports"
set rs = currentdb.openrecordset(strSQL,,dbfailonerror)

'loop through all of the customers
While not rs.eof

'this assumes you want to print the report
strCriteria = "CustomerID = " & rs("CustomerID")
docmd.OpenReport "reportname",acViewNormal,, strCriteria

rs.movenext
Wend
rs.close
set rs = nothing

End sub
 
E

Eva

Thank you for your response. I am going to analyse it and try it, but it
looks like I can do what you suggested.
(I am still on a learning curve with Access)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top