Wondering why, when a report is displayed in Print Preview mode and I hit ‘print’, it runs another query and takes some time to actually send to the printer

I'm wondering why, when a report is displayed in Print Preview mode and I hit ‘print’, it runs another query and takes some time to actually send to the printer.  Is there a way to avoid this?
SteveL13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnBusiness Consultant (Owner)Commented:
Preview is just that - so you can see the layout and number of pages to be printed.  Print is another and separate process, so it may process the data again, depending on the software. I have seen this and it varies for me.
0
mbizupCommented:
<<why, when a report is displayed in Print Preview mode and I hit ‘print’, it runs another query >>

From an MS Access perspective, I believe what is happening is that the query runs once when you use the following command: Docmd.openReport "YourReport", acViewPreview.  

The Print button then effectively runs the OpenReport command again in "Normal View" (hardcopy), thereby running the query a second time.

<<Is there a way to avoid this? >>

Try opening the report in REPORT VIEW instead of Print Preview:

Docmd.openReport "YourReport", acViewReport

Open in new window


Report View, unlike Print Preview can run code from command buttons placed on the report.  

Add a command button to the header section of the report with the following code to do the printout:

On Error Resume Next
Docmd.RunCommand acCmdPrint

Open in new window


This will print the currently loaded report without re-running the query.  (Opening the report using acViewReport at this point has already done the 'heavy lifting').
0
mbizupCommented:
Steve,

FYI, my comment above assumes you are running Access 2007 or later and that your database is in .accdb format.  Report View was not an option in earlier versions of Access.
0
PatHartmanCommented:
There is no way around this.  Access reruns the query to ensure the printed data is as fresh as possible.  To avoid this issue, I give my users an option group on the form that prints reports so if they don't need to preview the report, it can go straight to the printer.  If the open in print preview and then want to print, Access reruns the query and that's that.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.