Solved

Print a report in Access

Posted on 2013-01-22
4
541 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

770 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