Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I "Quick print" a form (VBA, Access 2007)?

Status
Not open for further replies.

sagamw

Technical User
Nov 11, 2009
104
GR
Yes, I know the argument "print a report, forms are not suitable for printing etc.)

I was using a button (with the predefined macro for printing)to print a form. The result was satisfactory, but I have a question.

How an I do this with VBA?
(I imagine is somethink like DoCmd....)

and MOST importantly,what is the VBA commands to QUICK PRINT the current form.
(i.e. to send to the printer silently, without opening preview, printer's properties etc.)
 
DoCmd.PrintOut

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV but for some reason (after I pressed the button with the command DoCmd.PrintOut) Access tries to print ...70 pages! (I ran to stop the printer from printing!)

I have my main form open, and over it is the (small) form with some of the data that I want to print (6-7 fields).

The "quick print" button is at the small form.

p.s. I found this reference
but I am not sure yet why access tries to print soooo many pages.

The regular print buttons prints fine...
 
I intercepted the printing (by making preview before printing as default) and IT IS the same page (my little form) 70 times!

That's weird.
Any ideas?

I will try to use the variant "Copies" of the DoCmd.PrintOut and set it to 1, but because this will be (soon) a commercial db I have fear that something can go wrong with my quick print button.
 
Extremely weird!!
Even if use DoCmd.PrintOut ,,,,1
I'm still getting 70 copies of my form. (Why 70?)
 
I did it with DoCmd.PrintOut ,1,1,,1,1
I am sure some 1s are unnecessary but anyway.

I wonder why 70 in the first place??
 
Hi Duane.

I have read in many sites comments like the following:

"However, forms are not really optimized to print out records and you may wish to present your data in a more user friendly approach."

To be honest I fail to see the benefits of using a report instead of a form, at least in my case.

I have this (small) form over my main form with some of the data of a single record. I press the "quick print" button I made earlier, and I get a WYSIWYG printout of my form.

I don't want the user to "customize" anything. Everything is in place and the way it should be.

So why do I need a report?

 
Forms generally have non-white backgrounds, combo boxes, list boxes, command buttons, etc that aren't appropriate for reports. In addition, you wouldn't be here asking about issues with printing out a form if you were printing a report.

You could have a command button that prints the report for the current record. The user would not have to "customize" anything. I'm not sure where that comment came from.

Reports have much greater flexibility in terms of formatting and layout. You can more easily handle sorting and grouping as well as page headers and footers, totaling and other good stuff. They can be much more appropriate for the printed page than a form.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top