Solved

Copies of print from textbox in Access

Posted on 2012-03-23
3
324 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 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

739 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