473,626 Members | 3,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SelectObj ect 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.OpenRepor t 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 3949
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.goo gle.com...
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.SelectObj ect 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.OpenRepor t 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********@nos pam.com> wrote in message news:<ys******* **********@news read1.news.atl. earthlink.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.goo gle.com...
"MacDermott " <ma********@nos pam.com> wrote in message

news:<ys******* **********@news read1.news.atl. earthlink.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********@nos pam.com> wrote in message
news:Sy******** *********@newsr ead1.news.atl.e arthlink.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.goo gle.com...
"MacDermott " <ma********@nos pam.com> wrote in message

news:<ys******* **********@news read1.news.atl. earthlink.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.OpenRepor t 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.RunComman d 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 programmaticall y. 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 SetNumberOfCopi es(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.OpenRepor t rptName, acDesign
Set rpt = Reports(rptName )
If Not IsNull(rpt.PrtD evMode) 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(strDevModeE xtra, 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
SetNumberOfCopi es stDocName, 5
DoCmd.OpenRepor t 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 SetNumberOfCopi es(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.OpenRepor t rptName, acDesign
Set rpt = Reports(rptName )
If Not IsNull(rpt.PrtD evMode) 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(strDevModeE xtra, 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
SetNumberOfCopi es stDocName, 5
DoCmd.OpenRepor t 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
2340
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 several times. Because printing is done on the client side, I thought that it would make sense to post this to newsgroups that cater to the JavaScript folk. Can anyone out there point me to how I would enforce this, that is, allowing only one...
9
4287
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
7021
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 following is the syntax that I use. The only problem is that I have the Database window hidden at all times and when I hit the print command button the report prints but the Database window becomes visible. DoCmd.SelectObject acReport,...
10
1757
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 which, of course, gives me 2 stacks containing pages 1-5 each?
1
8474
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 private void mn_file_print_Click(object sender, System.EventArgs e) { PrintDialog dlg = new PrintDialog();
9
12946
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 use some of this code: PrinterSettings printerSettings = new PrinterSettings(); printerSettings.MaximumPage = m_numberOfPages; printerSettings.MinimumPage = 1; printerSettings.PrintRange = PrintRange.SomePages; printerSettings.FromPage = 1;...
12
14391
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. The problem is : when users presses a pint button, a small form pops up asking number of copies to print (my intention is to print from the table the 0 + the number of copies, so if chosen 2 copies, we'll get 1 original + 2 copies).. What...
2
9330
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 please help me? Thanks Neetu
2
1370
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 the user click the button for each copy he needs I would like to be able to add a box that he can type the desired number of copies in. What code can I add to my print button that will take the number entered into a text box and print that many...
0
8713
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8644
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8514
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4208
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2632
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1516
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.