Solved

Copies of print from textbox in Access

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now