473,520 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

print multiple copies of the same report

38 New Member
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 happens is that if user writes 2 copies' I get all table printed twice )if I have 10 number in the table, I get 2 original + 20 copies.

What w'd be the code for that please?

Thanks.
Oct 25 '07 #1
12 14355
nico5038
3,080 Recognized Expert Specialist
When you have A2003 or higher, then several print options can be handled by code, but A2000 needs some "hard" and difficult coding.

I would probably instruct the users and when they are stubborn think about triggering a Popup form with a warning not to change the number of copies.

Nic;o)
Oct 25 '07 #2
eyalco
38 New Member
Thanks for that.
As Im already using a code, I'd appreciate if you'd see what am I doing wrong and fix it - if possible please?

The code :
Private Sub PRINTREP_Click()
On Error GoTo Err_PRINTREP_Click

Dim strDocName As String
Dim numCopies As Integer
Dim strLinkCriteria As String

strDocName = "RPT_INVOICE"

strCriteria = "[invoice_no]= " & Forms![FRM_INVOICE]![INVOICE_NO]

numCopies = Me![COPY]

DoCmd.SelectObject acReport, strDocName
DoCmd.PrintOut acSelection, , , , numCopies
DoCmd.CLOSE acReport, strDocName

Exit_PRINTREP_Click:
Exit Sub

Err_PRINTREP_Click:
MsgBox Err.Description
Resume Exit_PRINTREP_Click

End Sub
The me![copy] is where user states number of copies he's interested in - and there's the problem.

Hope you can assist.
Oct 26 '07 #3
nico5038
3,080 Recognized Expert Specialist
I don't know the "num copies" parameter of the DoCmd.PrintOut.
I would expect this code:
Expand|Select|Wrap|Line Numbers
  1. for intI = 1 to Me!Copy
  2.      docmd.OpenReport "rptYours", asPreview
  3. endif
  4.  
Nic;o)
Oct 27 '07 #4
eyalco
38 New Member
Thanks for your help. I'm trying your code for days now and in every combination I can think of - still, the end result is the same : the "me!copy" is not recognizable and whatever number I put in there, it prints all copies in the table.

Please, anything else comes to mind?

Thanks.
Oct 30 '07 #5
nico5038
3,080 Recognized Expert Specialist
Thanks for your help. I'm trying your code for days now and in every combination I can think of - still, the end result is the same : the "me!copy" is not recognizable and whatever number I put in there, it prints all copies in the table.

Please, anything else comes to mind?

Thanks.
Hmm, perhaps "copy" is a reserved word. Change the Name property (Under the Other tab) into "txtCopy" and change the FOR command to use "to Me.txtCopy"

Nic;o)
Oct 30 '07 #6
eyalco
38 New Member
Thanks again - nothing's changed.
I'm abouve up...

Can you check again my routine please?
Here's the print code in the invoice form (leading to the small txtcopy form) :

Dim msgResult As VbMsgBoxResult 'Boolean

msgResult = MsgBox("?äàí àú áèåçä ùàú øåöä ìòãëï", vbYesNo, "Important!")
If msgResult = vbNo Then
DoCmd.CLOSE acForm, Me.NAME
Exit Sub
End If

If msgResult = vbYes Then

Me.STATUS = "2"
Me.IS_PRINTED = True
INVOICE_NO = DMax("[INVOICE_NO]", "TBL_INVOICE") + 1

DoCmd.RunCommand acCmdSaveRecord

Dim strDocName As String
Dim strReportName As String
Dim strCriteria As String

If NewRecord Then
MsgBox "This record contains no data." _
, vbInformation, "Invalid Action"
Exit Sub
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Else
strDocName = "frm_copies"
strReportName = "rpt_invoice"
strCriteria = "[invoice_no]= " & [INVOICE_NO]

End If
On Error GoTo Err_Command109_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FRM_COPIES"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command109_Click:
Exit Sub

Err_Command109_Click:
MsgBox Err.Description
Resume Exit_Command109_Click

Const conErrDoCmdCancelled = 2501
If (Err = conErrDoCmdCancelled) Then
Resume Exit_PRINT2_Click
Else
MsgBox Err.Description
Resume Exit_PRINT2_Click
End If

If NewRecord Then
MsgBox "This record contains no data." _
, vbInformation, "Invalid Action"
Exit Sub
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Else
strReportName = "rpt_invoice"
strCriteria = "[invoice_no]= " & Me![INVOICE_NO]

DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
DoCmd.PrintOut , , , , [txtCOPY]

End If

Exit_PRINT2_Click:
Exit Sub

Err_PRINT2_Click:
MsgBox Err.Description
Resume Exit_PRINT2_Click

End If

End Sub
here's the code on the txpcopy form (where user states the num of copies he wants) :

Private Sub Command6_Click()
Dim strCriteria As String
strReportName = "rpt_invoice"

strCriteria = "[invoice_no]= " & Forms![FRM_INVOICE]![INVOICE_NO]

For intI = 1 To Me.TxtCOPY

DoCmd.OpenReport "rpt_INVOICE", asPreview
Next
end sub
Is there anything I can do for it to work please?
Thanks.
Oct 31 '07 #7
nico5038
3,080 Recognized Expert Specialist
Try:
Expand|Select|Wrap|Line Numbers
  1. dim strCriteria as String
  2. for intI = 1 to Me!txtCopy
  3.      strCriteria = "[invoice_no]= " & Me.[INVOICE_NO]
  4.      docmd.OpenReport "rptYours", asPreview,,strCriteria 
  5. endif
  6.  
Nic;o)
Oct 31 '07 #8
eyalco
38 New Member
Thanks for helping.
Im getting "microsoft office can't find the field "I" referred to in your expression"

By the way, Im righting "next" instead of "endif" you're writting as the "endif" not allowed in phraze.

Help?
Nov 1 '07 #9
nico5038
3,080 Recognized Expert Specialist
Yep, the endif was a typo, but the "I" isn't "visible" in my code.
Can you copy/paste the code used ?

Nic;o)
Nov 1 '07 #10
eyalco
38 New Member
Sure.

Private Sub Command8_Click()
Dim strCriteria As String
For intI = 1 To Me!TxtCOPY
strCriteria = "[invoice_no]= " & Me.[INVOICE_NO]
DoCmd.OpenReport "rpt_invoice", asPreview, , strCriteria
Next

End Sub
The debugg is on the filter criteria...

Really appreciate your help.
Nov 1 '07 #11
nico5038
3,080 Recognized Expert Specialist
Hmm, I suspect that your [invoice_no] is a text field, try:
Expand|Select|Wrap|Line Numbers
  1.  strCriteria = "[invoice_no]= '" & Me.[INVOICE_NO] & "'"
  2.  
Text needs to be embedded in single quotes ( ' ).

Nic;o)
Nov 1 '07 #12
mshmyob
904 Recognized Expert Contributor
Not exactly sure what you are asking but if you are trying to set the number of copies to print you could use this code that I use all the time.

Dim rpt As Report


Dim strDefaultPrinter As String
' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName
' switch to printer of your choice:
Set Application.Printer = Application.Printers(strDefaultPrinter)
' open report but in hidden mode so you can apply parameters to it such as number of copies to print
DoCmd.OpenReport "PickSlip", acViewPreview, , , acHidden
' set my parameters for the print job
Set rpt = Reports!PickSlip
rpt.Printer.Copies = cmbCopiesPick.Value
' activate my print job by unhiding it
DoCmd.OpenReport "PickSlip", acViewNormal
DoCmd.Close acReport, "PickSlip", acSaveNo

Set Application.Printer = Nothing
Jan 7 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

9
4284
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
8
3937
by: Hank Reed | last post by:
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...
3
7016
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...
1
8415
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();
3
1306
by: Rob Meade | last post by:
Hi all, I have created 7 web custom controls for 7 sections of our template. I have them currently on my local pc - where vs placed them...the plan was that I would create these - throw them into a central location then the rest of our team would be able to use them to create our generic template for our applications etc... One thing...
4
1435
by: andre.roberge | last post by:
I'm using a js script (approx. 300 lines) from someone else to create dynamically some web pages, using Python. Unfortunately, I am not familiar with javascript :-( I now want to reproduce the same functionality given by the script at multiple points in the page. Basically, the script goes like this /* whole bunch of functions with...
3
1907
by: Aliriazi | last post by:
All, I have created a simple database, which includes a receiving table and outgoing table in my receiving table I have a multiple entry of the same fields. I am trying to create a query that contains receiving table, which is adding the quantity of the same field and minus the outgoing table. The question I have is how can I prevent multiple...
2
9314
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
0
7326
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7243
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7471
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. ...
0
7632
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...
1
7213
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...
0
7595
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...
0
5771
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4809
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...
0
1687
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

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.