Solved

Print a report in Access

Posted on 2013-01-22
4
584 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

691 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