mshmyob 904
Recognized Expert Contributor
I am using Access 2007 but any VBA code will probably work.
I need to display which copy number I have printed.
For example if the user prints 4 copies I need to display the following in the page footer of each copy respectively:
Copy 1
Copy 2
Copy 3
Copy 4
Any ideas would be appreciated.
If you can get it to show Copy 1 of 4, Copy 2 of 4, etc that would be even better.
12 5099 MMcCarthy 14,534
Recognized Expert Moderator MVP
I haven't really thought about this but two things immediately pop to mind.
First one is that you will have to create a public variable to hold the total number of copies to be printed. A value which will have to be entered by the user when sending to print.
Secondly, you will need to look at creating some kind of loop in the on Print procedure of the report. Then somehow increment from one to the value stored in the public variable.
mshmyob 904
Recognized Expert Contributor
Thanks. I already ask for the number of copies so I have that as a variable in another form. So I will make it public and pass it along to the report and try and create a counter.
I don't know if the counter will clear each time a copy of the report is printed but I will give it a try and let you know.
I haven't really thought about this but two things immediately pop to mind.
First one is that you will have to create a public variable to hold the total number of copies to be printed. A value which will have to be entered by the user when sending to print.
Secondly, you will need to look at creating some kind of loop in the on Print procedure of the report. Then somehow increment from one to the value stored in the public variable.
mshmyob 904
Recognized Expert Contributor
Ok I have tried passing variables and it won't work. I think I figured out why and if anyone can figure out a better way I would appreciate it.
I open my report from a form but set the number of copies like so -
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
-
This code sets the number of copies for the printer to print.
I then open the report and it prints.
The problem is that the report looks at it as printing a single report and the printer controls the number of prints.
I guess I could change the code and have say 4 lines of docmd.openrepor t and each one would be a copy but that seems very ineficient.
Anyone know any other way other than having multiple docmd.openrepor t commands.
I haven't really thought about this but two things immediately pop to mind.
First one is that you will have to create a public variable to hold the total number of copies to be printed. A value which will have to be entered by the user when sending to print.
Secondly, you will need to look at creating some kind of loop in the on Print procedure of the report. Then somehow increment from one to the value stored in the public variable.
MMcCarthy 14,534
Recognized Expert Moderator MVP
I'll see if any of the other experts are aware of anything.
Rabbit 12,516
Recognized Expert Moderator MVP
What if you looped the print command while at the same time incrementing a print count variable? And then calling those controls from the report? -
Dim CurrentCount As Integer, MaxCount As Integer
-
-
MaxCount = txtMaxCount
-
-
For CurrentCount = 1 To MaxCount
-
txtCurrentCount = CurrentCount
-
DoCmd.OpenReport "rpt_Name"
-
Next CurrentCount
-
This is just a brain´storming suggestion since I´m not at my main computer and can´t do any testing on the computer I´m using to write this, but don´t forget the .Print method.
Again from the top of my head I´m thinking of a function that would recieve the number of copies from a public variable, and increment them, then by directly printing to the page (which is the advantage of the .Print method, doing away with the need to tie your variables to report controls) you thereby have greater and easier control over what you are wanting to do.
Just ideas, good luck, and I´ll keep an eye on this as much as I can. I´m still, unfortunately, not at a firm location yet, but will be getting back to normal in the next week.
Regards,
Scott
NeoPa 32,585
Recognized Expert Moderator MVP
From my understanding of printing multiple copies of a report (using the .Copies property) it would be impossible to do what you ask as they are just that - copies.
To produce the result that you want you would need to take the approach suggested and code printing of the report n times (with one copy each time). This is slightly different as certain variables (like Print Date & Print Time would be different using this approach but exactly the same when using the .Copies approach.
To get a public variable to be accessed by an object like a report in the newer versions of Access (I don't use 2007 but I've noticed even 2003 is stricter in this than 2000 was and that was more so than 97) you will need to define a public function to return the value required. In the new versions it's probably worth designing a function with increased flexibility to handle passing various values as I anticipate it being required more with the newer strictures. I'm afraid I can't provide an example now as I'm only just starting to find some 2003 users on my databases at work. I expect I will have one in the not too distant future, but that won't help you now I'm afraid.
mshmyob 904
Recognized Expert Contributor
By the sounds of it I will need to scrap the code I have for the number of copies and use a counter loop and the openargs property to pass a variable to the report. I will re-code and let you guys know how it worked out.
It's too bad Access doesn't have the function built into the report for copies like they do for page counts.
From my understanding of printing multiple copies of a report (using the .Copies property) it would be impossible to do what you ask as they are just that - copies.
To produce the result that you want you would need to take the approach suggested and code printing of the report n times (with one copy each time). This is slightly different as certain variables (like Print Date & Print Time would be different using this approach but exactly the same when using the .Copies approach.
To get a public variable to be accessed by an object like a report in the newer versions of Access (I don't use 2007 but I've noticed even 2003 is stricter in this than 2000 was and that was more so than 97) you will need to define a public function to return the value required. In the new versions it's probably worth designing a function with increased flexibility to handle passing various values as I anticipate it being required more with the newer strictures. I'm afraid I can't provide an example now as I'm only just starting to find some 2003 users on my databases at work. I expect I will have one in the not too distant future, but that won't help you now I'm afraid.
NeoPa 32,585
Recognized Expert Moderator MVP
You're showing a fine attitude here and I hope we can help you some more (or maybe even that you won't need more help) when you've adjusted your code.
However, I feel you're labouring under a misaprehension about copies. The property and the term. - .Copies are a property of the print and not managed by Access at all (other than to pass the request on to the printer driver.
- A copy would NOT be a copy if it were not exactly the same. As soon as you introduce a copy counter into the printed output, it ceases to be a copy. Using the term loosely it may be used in general parlance, however the name "Copies" was chosen precisely to match the facility provided.
That's not at all to say that what you want to do can't be done, or even that you shouldn't refer to the results as copies. Just bear in mind that there will always be a level of ambiguity when terming them thus.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: mary |
last post by:
I need to display 10 fields (columns) to display in a
crystal Report. When I am trying to print the report some
of the columns are cutting off from the report. Is there
any way to display the report horizontally. I am using
Crystal Report 9. Please some body help me
Thanks
mary
|
by: Bill |
last post by:
I have the user fill in a form and then click a control to send a
notice to the lab that the form has been filled in along with the file
reference number. I'd like to attach a copy of the form to the email.
How do I
1. Autogenerate a report that is an exact copy of the input form.
2. Attach the report directly without saving a copy somewhere.
I'm using Lotus Notes so I think I need to use something like a Select
|
by: Saintor |
last post by:
I have a record with with a quantity value. I have to print one record for
each quantiy with a counter, incrmementing on each copy. I wan't to avoid
to use many docmd.openreport instructions.
I succeeded by creating a temporary table, adding by code the job number and
the cumulative quantity value. But I am not satisfied. Is there a way to
do this without a temporary table, from within the report's code only? TIA.
|
by: Edward |
last post by:
ASP.NET
SQL Server 2k
Our clients need to output a pretty complicated Consignment/Delivery
Note from their system. It is in tabular form, but each row can have
a) a different number of columns, and b) cells of varying width and
height. I can mimic this in both Word and Access, and using either
Access' reporting functions or Word's mailmerge, can output a report
as I require.
|
by: GB |
last post by:
Okay, here is what I am trying to do
We have a dialog of windows that collects information for generation of a dynamic HTML report. The last page in the wizard dialog accepts all report options (in XML format) and calls a business tier object in the pageLoad event, which creates the HTML report file. This file is then streamed to the client
This process works well, and whilst we have tuned it to death it still takes between 1-5 seconds...
| |
by: ZinksInk |
last post by:
How do I make a report display the current record open in a form?
This seems like it should be a simple issue however I am strugling to figure out what code SQL / Querry I should use to do this.
I have orders for skylights orginized by invoice. As we track production different reports need to be printed out. I want to beable to click on my report such as "Print Welding Tag" and have this insert the current Invoice number to the report.
...
|
by: Jimmy |
last post by:
On the subreport, records are grouped by WorkDate. In the WorkDate header
there is a textbox named DateCounter with the control source =1 and running
sum set to yes. In either the report footer or the WorkDate footer (I tried
both with no difference) is a textbox called DateCount, the control source
of which is =DateCounter. If this subreport is run as a seperate report,
DateCounter shows 1...2...3...etc for each seperate WorkDate and...
|
by: Vayse |
last post by:
On my Help/About screen, I'd like to display
1) The version number, as it appears in the Publish screen.
2) The version number of the Report Viewer control.
How would I do this?
Thanks
Vayse
|
by: Gord |
last post by:
I have a report whose Record Source I set in code when clicking on a command
button on a form. This Record Source is a table that gets created by the
code. I have a textbox on the report whose Control Source is a field in
this table. The field type is currency. Everything works good so far.
When the value in the field is zero dollars $0.00, I want to conditionally
display "N/A" (not applicable) instead of $0.00 on the report...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |