Solved

Print a report in Access

Posted on 2013-01-22
4
495 Views
Last Modified: 2013-01-22
Dear Experts, can i print an access report without opening it?
I have a report with one input parameter, now it is printing after open the report.(right click on report then print).
But the user need to print it directly by clicking on a command button - without opening the report and without give the in put parameter.
Please give me some good ideas.
Thanks
0
Comment
Question by:gtmathewDallas
4 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 450 total points
ID: 38806240
try using  DoCmd.PrintOut

DoCmd.PrintOut [printrange][, pagefrom, pageto][, printquality][, copies][, collatecopies]


DoCmd.SelectObject acReport, "nameofreport", True

DoCmd.PrintOut , , , , 2  'will print two copies of the report
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 50 total points
ID: 38806391
"I have a report with one input parameter"

Then you have to supply the parameter value.  You can't miss this out.

If you don't want to supply a parameter value you have to remove the parameter from the report's recordsource.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38806516
Use a form with a textbox for the user to specify the criteria parameter and a command button to print the report.

Change the report's recordsource to read the parameter from the form ... something like this (for example purposes, I'm assuming a date field for the parameter):

SELECT * FROM YourTable WHERE YourDateField = Forms!YourFormName!txtYourTextboxName

Open in new window

The code behind the command button to send the report directly to the printer (without opening it in preview):

Docmd.OpenReport "YourReportName", acViewNormal

Open in new window

0
 

Author Closing Comment

by:gtmathewDallas
ID: 38806547
Thanks Capricon...Its a good solution..Thanks Peter and Mbizup
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This collection of functions covers all the normal rounding methods of just about any numeric value.
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

708 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

11 Experts available now in Live!

Get 1:1 Help Now