Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Copies of print from textbox in Access

Posted on 2012-03-23
3
Medium Priority
?
333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 1500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

722 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