Force new print job

M

Mike Storms

Can Access force a new print job for each record in a bound recordsource? I
have a report based on a recordset of several clients that creates several
pages of information for each client. I'm sending the report to a special
printer that binds and staples the output. I want to end up with one bound
report for each client, but Access sends the report as one big print job and
the printer binds all the clients's output into one big stack.

If I can't do this, I will have to make Access step through each client in
the recordset and print a separate report for each one. I have a general
idea of how to do this, but I don't know exactly how to write the code. Any
suggestions would be very appreciated.

Thanks,
Mike
 
Y

Yuan Shao

Hi Mike,

Thanks for your post. If I understand correctly that you have a report
based on a record set of several clients that creates several pages of
information for each client. You want to print the report for each client.

Based on my experience, it seems that you can try to dynamically update a
Report. You can use VBA to add a new record source property to a report.
While your application causes a report's record source to change, you can
print the report for each client.

Thanks for posting in commutniy.

Regards,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
S

SA

Mike:

Sure, its pretty simple to do, here's how:

1.) Open a recordset based on the query that underlies your report;
2.) assuming that each client has a client ID, you then filter the report
for each client as you loop through the records like this:

Dim rsClientReport as Recordset
'Using DAO code
Set rsClientReport = CurrentDb.OpenRecordset("Select Distinct ClientID from
"MyReportQuery",dbopensnapshot)
With rsClientReport
Do Until .EOF 'End of file
DoCmd.OpenReport "MyClientReport, acViewNormal, , "[ClientID] = " &
!ClientID 'from the recordset
DoEvents
.MoveNext
Loop
.Close
End With

That should do it
 
S

SA

Michael:

This would be much easier done by filtering the report rather than changing
the record source. See my post in this thread on this topic.

Steve Arbaugh
Access MVP
 
M

Mike Storms

Steve,

Thanks for the code. It does exactly what I need. One question: what does
the DoEvents line accomplish?

Thanks,
Mike


SA said:
Mike:

Sure, its pretty simple to do, here's how:

1.) Open a recordset based on the query that underlies your report;
2.) assuming that each client has a client ID, you then filter the report
for each client as you loop through the records like this:

Dim rsClientReport as Recordset
'Using DAO code
Set rsClientReport = CurrentDb.OpenRecordset("Select Distinct ClientID from
"MyReportQuery",dbopensnapshot)
With rsClientReport
Do Until .EOF 'End of file
DoCmd.OpenReport "MyClientReport, acViewNormal, , "[ClientID] = " &
!ClientID 'from the recordset
DoEvents
.MoveNext
Loop
.Close
End With

That should do it
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

Mike Storms said:
Can Access force a new print job for each record in a bound
recordsource?
I
have a report based on a recordset of several clients that creates several
pages of information for each client. I'm sending the report to a special
printer that binds and staples the output. I want to end up with one bound
report for each client, but Access sends the report as one big print job and
the printer binds all the clients's output into one big stack.

If I can't do this, I will have to make Access step through each client in
the recordset and print a separate report for each one. I have a general
idea of how to do this, but I don't know exactly how to write the code. Any
suggestions would be very appreciated.

Thanks,
Mike
 

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