Solved

Copies of print from textbox in Access

Posted on 2012-03-23
3
317 Views
Last Modified: 2012-06-27
I m want to print a random number of copies(reports) from an Access form using a textbox for example.

So basically i have a print button on form that would automatically print a report.I need to change the number of copies each time i print and i don t want to go through the process of changing it each time in the print properties.Can i set a textbox next to the print button that would take the appropriate number of copies and then print?
0
Comment
Question by:The_Nibbler
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 375 total points
ID: 37756415
Give this a try:


DoCmd.OpenReport "YourReportName", acViewPreview
DoCmd.PrintOut  Copies:=NZ(Me.YourTextBoxName,1)
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37756439
Just a note - The NZ in the above code defaults the number of copies to 1 if the textbox is left blank/null.

You can set that default to anything you want, or include conditional code to not print anything at all if the textbox is blank.  

You should definitely customize the code in this respect to ensure it behaves like you want it to for special cases like blanks, zeros or typos/user input errors, and possibly set a 'sensible' upper limit for the allowable number of pages.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37756991
<No Points wanted>

For example, insert a combobox on the from in place or the textbox.
Load the combobox with integers from 1 to ...say 25.

Set the Limit to list property to: No
...so they cant really type in anything other than what is in the list.

Like mbizup states, you can set the default value to be 1 as well...


;-)

Jeffcoachman
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question