By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Print multiple copies

P: n/a
Hello,
I have searched through dozens of old responses to this question
but have been unable to make it work in my situation. I'm using
Access 2000

We have a very old sticker printer on a serial line. Neither
situation is going to be upgraded so don't suggest that. A simple
sticker report takes 10 seconds to reach the printer. That is not an
issue for me. But, if I want 5 copies of the same sticker, most
methods I have tried really send 5 separate reports and each one takes
10 seconds to get there. I have tried:

DoCmd.SelectObject A_REPORT, strReportName, TRUE
DoCmd.PrintOut,,,,5
DoCmd.Close A_REPORT, strReportName
Some have suggested DoCmd.Print which generates the message
"Object does not support this prooerty or method"

I also tried:
DoCmd.OpenReport strReportName, A_PREVIEW
DoCmd.PrintOut,,,,5
DoCmd.Close A_REPORT, strReportName

The only thing that DOES work is to bring up the print dialog
box, select the number of copies with the mouse, and click OK. Then
the 5 copies go as one report. Obviously, I would like to make that
happen programatically.
Thanks
Hank Reed
Nov 12 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Your report is based on a table or query.
Let's say its name is qryRpt.
In your report's OnOpen event procedure, you could do this:

Me.recordsource=
"SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT *
FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt"

HTH
- Turtle

"Hank Reed" <ha********@aol.com> wrote in message
news:f4**************************@posting.google.c om...
Hello,
I have searched through dozens of old responses to this question
but have been unable to make it work in my situation. I'm using
Access 2000

We have a very old sticker printer on a serial line. Neither
situation is going to be upgraded so don't suggest that. A simple
sticker report takes 10 seconds to reach the printer. That is not an
issue for me. But, if I want 5 copies of the same sticker, most
methods I have tried really send 5 separate reports and each one takes
10 seconds to get there. I have tried:

DoCmd.SelectObject A_REPORT, strReportName, TRUE
DoCmd.PrintOut,,,,5
DoCmd.Close A_REPORT, strReportName
Some have suggested DoCmd.Print which generates the message
"Object does not support this prooerty or method"

I also tried:
DoCmd.OpenReport strReportName, A_PREVIEW
DoCmd.PrintOut,,,,5
DoCmd.Close A_REPORT, strReportName

The only thing that DOES work is to bring up the print dialog
box, select the number of copies with the mouse, and click OK. Then
the 5 copies go as one report. Obviously, I would like to make that
happen programatically.
Thanks
Hank Reed

Nov 12 '05 #2

P: n/a
"MacDermott" <ma********@nospam.com> wrote in message news:<ys*****************@newsread1.news.atl.earth link.net>...
Your report is based on a table or query.
Let's say its name is qryRpt.
In your report's OnOpen event procedure, you could do this:

Me.recordsource=
"SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT *
FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt"

HTH
- Turtle

Thanks for the idea. Even though it would be easy to generate
your SQL string programatically, it would be a little cumbersome for
50 stickers. Anyway, I tried it, as well as simply putting n number
of identical records in the table. In both cases they went out as n
reports with the ten second delay between each.
If anyone knew the way the print dialog does it or if there was a
way to preload the print dialog with the number of copies and then
programatically execute from the dialog box - that would be OK.
I suspect that, in many cases, we are unaware that there are
actually 3 reports (not 3 copies) going out because most printer
interfaces take less than a second to transfer the data. In this
unique situation, the ten second delay makes in clear what is
happening.
Thanks,
Hank Reed
Nov 12 '05 #3

P: n/a
"The way the Print Dialog does it" is inside the printer driver, which is
not generally accessible to Access.

You could, of course, try SendKeys to send the appropriate keystrokes to
emulate keyboard input.
While this is rarely a robust approach, it has worked for me in some
relatively static cases.

- Turtle

"Hank Reed" <ha********@aol.com> wrote in message
news:f4**************************@posting.google.c om...
"MacDermott" <ma********@nospam.com> wrote in message

news:<ys*****************@newsread1.news.atl.earth link.net>...
Your report is based on a table or query.
Let's say its name is qryRpt.
In your report's OnOpen event procedure, you could do this:

Me.recordsource=
"SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt"
HTH
- Turtle

Thanks for the idea. Even though it would be easy to generate
your SQL string programatically, it would be a little cumbersome for
50 stickers. Anyway, I tried it, as well as simply putting n number
of identical records in the table. In both cases they went out as n
reports with the ten second delay between each.
If anyone knew the way the print dialog does it or if there was a
way to preload the print dialog with the number of copies and then
programatically execute from the dialog box - that would be OK.
I suspect that, in many cases, we are unaware that there are
actually 3 reports (not 3 copies) going out because most printer
interfaces take less than a second to transfer the data. In this
unique situation, the ten second delay makes in clear what is
happening.
Thanks,
Hank Reed

Nov 12 '05 #4

P: n/a
CDB
A possible approach is to modify your report. You can use the MoveLayout,
NextRecord and PrintSection properties to control how many times a detail
section prints. The PrintCount variable in the Detail_Print event can
control the number of iterations.

MS Knowledgebase has several articles on how to print varying numbers of
labels using a stored number-to-print field in a table, or to start printing
at a particular position on a label sheet.

The techniques could be used to modify your report in your situation, I am
sure.

Clive

"MacDermott" <ma********@nospam.com> wrote in message
news:Sy*****************@newsread1.news.atl.earthl ink.net...
"The way the Print Dialog does it" is inside the printer driver, which is
not generally accessible to Access.

You could, of course, try SendKeys to send the appropriate keystrokes to
emulate keyboard input.
While this is rarely a robust approach, it has worked for me in some
relatively static cases.

- Turtle

"Hank Reed" <ha********@aol.com> wrote in message
news:f4**************************@posting.google.c om...
"MacDermott" <ma********@nospam.com> wrote in message

news:<ys*****************@newsread1.news.atl.earth link.net>...
Your report is based on a table or query.
Let's say its name is qryRpt.
In your report's OnOpen event procedure, you could do this:

Me.recordsource=
"SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt UNION ALL SELECT * FROM qryRpt"
HTH
- Turtle

Thanks for the idea. Even though it would be easy to generate
your SQL string programatically, it would be a little cumbersome for
50 stickers. Anyway, I tried it, as well as simply putting n number
of identical records in the table. In both cases they went out as n
reports with the ten second delay between each.
If anyone knew the way the print dialog does it or if there was a
way to preload the print dialog with the number of copies and then
programatically execute from the dialog box - that would be OK.
I suspect that, in many cases, we are unaware that there are
actually 3 reports (not 3 copies) going out because most printer
interfaces take less than a second to transfer the data. In this
unique situation, the ten second delay makes in clear what is
happening.
Thanks,
Hank Reed


Nov 12 '05 #5

P: n/a
Turtle sent me the idea of using the print dialog box and sendkeys. I
tried that but the dialog is modal and ignores my keystrokes until
after it closes.
The solution is to send the keystrokes first and they are queued up,
waiting for the print dialog to come up. Here is the code.

DoCmd.OpenReport stDocName, acPreview
' You can send keys that you want to act on the printer dialog box
' but send them first and they will be queued up when the dialog
' appears.
' Four tabs get you to the "Number of Copies" box, 5 is the desired
' number of copies and the Carriage Return at the end
' executes and closes the dialog.

SendKeys vbTab
SendKeys vbTab
SendKeys vbTab
SendKeys vbTab
SendKeys "5" & vbCr
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, stDocName

I haven't tried this at work yet on the slow printer interface.
Instead I'm being a geek and working on it at home on Sunday.

Thanks for the help,
Hank Reed
Nov 12 '05 #6

P: n/a
You can use the PrtDevMode property of the report to edit the number
of copies to be printed. This involves transiently opening of the
report in design mode. Many of the parameters in the print dialog can
then be modified programmatically. For further details see the
PrintDevMode topic in the help files.

Tony R.
Nov 12 '05 #7

P: n/a
Thanks to everyone who had an idea about printing 3 copies and not 3
reports. This function works:

' Copied from Access help subject PrtDevMode 02/16/04
' Use the PrtDevMode property to change the number of copies a report
will print
' This actually changes the design of the report
Sub SetNumberOfCopies(rptName As String, NumberOfCopies As Integer)

Dim DevString As str_DEVMODE
Dim dm As type_DEVMODE
Dim strDevModeExtra As String
Dim rpt As Report

' Open report in Design view.
DoCmd.OpenReport rptName, acDesign
Set rpt = Reports(rptName)
If Not IsNull(rpt.PrtDevMode) Then
strDevModeExtra = rpt.PrtDevMode
' Gets current DEVMODE structure.
DevString.RGB = strDevModeExtra
LSet dm = DevString
dm.intCopies = NumberOfCopies ' Set copies requested by user
LSet DevString = dm ' Update property.

' The next two lines I got from the Access news group
' that showed how to update the report design data
' that you just changed above
Mid(strDevModeExtra, 1, 94) = DevString.RGB
rpt.PrtDevMode = strDevModeExtra
End If

End Sub

Code snippet to call the above function

stDocName = "Sticker Label"
' Change the design of the label report to
' use current number of stickers 02/21/04
SetNumberOfCopies stDocName, 5
DoCmd.OpenReport stDocName, acPreview
DoCmd.PrintOut acPrintAll
' DO NOT save design change
DoCmd.Close acReport, stDocName, acSaveNo
Thanks,
Hank Reed
Nov 12 '05 #8

P: n/a
On 24 Feb 2004 12:28:59 -0800, ha********@aol.com (Hank Reed) wrote:
Thanks to everyone who had an idea about printing 3 copies and not 3
reports. This function works:

' Copied from Access help subject PrtDevMode 02/16/04
' Use the PrtDevMode property to change the number of copies a report
will print
' This actually changes the design of the report
Sub SetNumberOfCopies(rptName As String, NumberOfCopies As Integer)

Dim DevString As str_DEVMODE
Dim dm As type_DEVMODE
Dim strDevModeExtra As String
Dim rpt As Report

' Open report in Design view.
DoCmd.OpenReport rptName, acDesign
Set rpt = Reports(rptName)
If Not IsNull(rpt.PrtDevMode) Then
strDevModeExtra = rpt.PrtDevMode
' Gets current DEVMODE structure.
DevString.RGB = strDevModeExtra
LSet dm = DevString
dm.intCopies = NumberOfCopies ' Set copies requested by user
LSet DevString = dm ' Update property.

' The next two lines I got from the Access news group
' that showed how to update the report design data
' that you just changed above
Mid(strDevModeExtra, 1, 94) = DevString.RGB
rpt.PrtDevMode = strDevModeExtra
End If

End Sub

Code snippet to call the above function

stDocName = "Sticker Label"
' Change the design of the label report to
' use current number of stickers 02/21/04
SetNumberOfCopies stDocName, 5
DoCmd.OpenReport stDocName, acPreview
DoCmd.PrintOut acPrintAll
' DO NOT save design change
DoCmd.Close acReport, stDocName, acSaveNo
Thanks,
Hank Reed

Another simple solution to produce multiple copies is to create a table (tblPrintCopies) with a single integer field. Add one record for each copy
required (1,2,3,4,5 etc). Add this table to the recordsource of the report with no joins to any other table. When the recordsource query is run,
because a relationship between tblPrintCopies and the other table(s) cannot be established the query will produce a line for each entry in
tblPrintCopies. So if tblPrintCopies contains 5 records, the recordsource will produce 5 records for each "true" record in your other tables, as such
when printed, the report will generate 5 copies.

If you want to actually show a copy description in your report, instead of using integers in tblPrintCopies use a text field and enter records for
"Original", "File Copy", "Customer Copy" etc. Drag this field into the recordsource and bind a control on your report to this field. When printed each
copy will be identical except for the copy description field.

Wayne Gillespie
Gosford NSW Australia
Nov 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.