473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Print multiple copies

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
8 3916
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
"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
"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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Terry Murray | last post by:
Hi Everybody, I have been given the task of creating an online coupon system. The only real challenge that I can identify at this point is allowing only one coupon to be printed rather than...
9
by: David Allison | last post by:
cmdButton to Print 3 copies of record in Form view ? cmdButton will print 1 but I need 3 copies of the one Form record. -- Dave Allison
3
by: TDIOwa | last post by:
I have a report printing form (Access 97) in which I print different reports from. I have added a combo box that selects the number of copies that I want to print. Here is the rub... The...
10
by: MLH | last post by:
If I wanted 2 of each page, could I make them print out 2 of first page, 2 of second page, 2 of third page, 2 of fourth page and 2 of 5th page? Or, do I have to run the openreport method twice...
1
by: ekey | last post by:
Hi follow function to print many copies but it only print one copy, my document is only one page; but i want to print many copies .such as three copies. how to do? Where do it error? THS ...
9
by: trint | last post by:
Instead of just sending one document at a time, I need to send multiple documents as a print job because our laserprinter will only stack and staple one printjob it receives at a time. I need to...
12
by: eyalco | last post by:
I have a report which I need to copy in 2 different lables. I've set a table with numbers from 0-10 (0 gets "original and all the others get "copy"). The caption is changed by IIF - so now all is ok....
2
by: nrnviv | last post by:
I saw your article on CR and have a question if you can help. using crystal report in VS 2005 C#. I want to print multiple copies(3) of a same report in a single page. Is is possible. Can you ...
2
by: MyWaterloo | last post by:
Hi, I have a databases used to keep track of our purchase orders at my company. There are times when I need to print one copy of an order and times when I need to print multiple. Instead of having...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.