Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display full report but only print page 1 & 2

Posted on 2014-09-03
13
Medium Priority
?
560 Views
Last Modified: 2014-09-04
Access report with multiple subreports, displays about 15 pages of data. Customers usually print the first 2 pages and the other 13 pages are thrown away. My customers do not want the report changed, they like to see the information displayed on screen but are printing out the whole report.(instead of using the print dialog and selecting page 1 to 2)

To save paper I want to only print out page 1 & page 2 when the user prints the report. Is there a way to control this via a vba onprint statement? Please post the code?
0
Comment
Question by:Dalexan
[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
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 27

Assisted Solution

by:MacroShadow
MacroShadow earned 1000 total points
ID: 40302976
Use the following command to print the report:
DoCmd.PrintOut acPages, 1, 2

Open in new window

0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40303044
You might want to consider supplying a custom button to do that.  That will give the user what they want usually but still retain the possibility to print the complete report should it be required occasionally.
0
 

Author Comment

by:Dalexan
ID: 40303426
How can I capture the print command instead of creating a button.

Public Sub PrintReport()
On Error GoTo Err_PrintReport

    DoCmd.OpenReport "REPORT: Site / Campaign / VoterInfo", acViewPreview
    DoCmd.PrintOut acPages, 1, 2

Exit_PrintReport:
    Exit Sub

Err_PrintReport:
    MsgBox Err.Number & " (" & Err.Description & ") in procedure PrintReport"
    Resume Exit_PrintReport

End Sub
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 26

Accepted Solution

by:
Nick67 earned 1000 total points
ID: 40303887
"Is there a way to control this via a vba onprint statement?"
"How can I capture the print command instead of creating a button."

If you click on the MS-supplied printer icon button on a toolbar/ribbon, the whole report will be printed.
You cannot intercept that call via VBA.
If you are using Access 2007 and greater, you can customize the Ribbon (which has a fairly steep learning curve) to eliminate that button and then replace it with a custom button(s) of your own on the Ribbon.  MS makes it ridiculously difficult, but not impossible, to intercept the commands issued by Ribbon buttons, through Ribbon customizations, and replace them with your own -- but I wouldn't go there because it is incredibly hard to do and get right for a single specific report.  It can be a little easier to do so universally for all reports in an application, but even then MS clearly has made it tough for developers to monkey with their sainted FluentUI.

Best practices usually dictate that the NavPain and/or database window are hidden from end-users.  The usual method of opening reports is to click a button on a form.  The form and the code behind the button then supply any parameters and OpenArgs that the report may then need.  It is suggested that in this case you should have one button labeled 'Preview Report' and another labeled 'Print First Two Pages' for your users.

In general, you should not have your users using the MS-supplied controls for much of anything -- because YOU cannot exert influence over what those controls do.  If you condition users to use the MS-supplied controls, and then requirements change so that their innate actions are not what you want, you are then screwed.  Controls that YOU place on forms are under your complete command, and you can change how they behave a circumstances dictate.

You could take the time to try to learn how to customize the Ribbon.  A better use of your time will be in honing your app so that users don't need to, and aren't tempted to, use the MS-supplied UI for anything, and re-educating your users.

That's my advice, anyway.

Nick67
0
 

Author Comment

by:Dalexan
ID: 40303929
Thanks, this is good advice Nick. We're working on abandoning all microsoft tech within the next year so I'm abandoning this idea to intercept the print command.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40303950
May I ask why you are abandoning MS and what you hope to move to?
0
 

Author Comment

by:Dalexan
ID: 40303994
The litany of microsoft versions has me lost in a giant list of what system supports what version. We're already developing using rails and moving our reporting tools to an in house built MVC/ruby framework. Much easier to support without all the MS bullshit.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40304057
I don't have much faith in anyone right now.  Firefox and their rapid rev'ving makes them an unsuitable platform--but everyone seems to have caught that disease.  Very few have understood that the slow decline of XP and old verisons of IE indicate that a VERY large group of folks want a platform that remains stable and unchanging for a decade or more.  Rapid change is not a bonus in a mature product.  And the Cloud is not a intelligent option for most because of the stupidly high cost of high-speed upload capability.  'Let's back everything up to the Cloud!'  'Great, you try and push a terabyte up to the Cloud, and tell me how long that'll take, and if and when you get it up there, tell me how long it'll take to suck it back down in a DR situation'

Sigh.

Maybe I am an old dinosaur.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40304080
>>And the Cloud is not a intelligent option...
Unless the stuff stored there is well encrypted it is not something to trust with confidential information either.

To be honest I suspect lots of people in the software organisations would prefer a slower cycle, but the marketing people need a new product to justify their existence.

ps.  Dinosaurs were around for 150 million years, they were doing something right.
0
 

Author Comment

by:Dalexan
ID: 40304137
Are you also abandoning MS technology's?
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40304236
No...
But the removal of Exchange from the SBS replacements (WIndows Server Essentials) means that things have gotten very pricey and complex (the cheapest solution for 25+ users licensing-wise is to install Windows Server as a hypervisor, and then Windows Server twice as a VM, once as a domain controller and Essentials Experience unit, and once to run Exchange.)  And then you need all the bloody CALs, both Server and Exchange.  Much more expensive.
And...
MS has SharePoint-itis.  I am an Access guy.  There's no need to manage thousands of Word and Excel documents.  That's what Access reports are for :)  MS has left the VBA platform twisting in the wind, in favor of this 'Look ma, no code (only intermediate functionality, but no code!) thing.  They should know from the complete thud that Surface RT devices landed with that the VBA platform is the very thing that continues to drive Office (remember what occurred with that Office for Mac version that had no VBA support?)  But they sure don't talk or act like they know it.

It'll be a lot like the moderate Republican experience -- I didn't leave them, they left me.
0
 

Author Comment

by:Dalexan
ID: 40304282
It'll be a lot like the moderate Republican experience -- I didn't leave them, they left me.
I like it, haha! My girlfriend happens to be a systems analyst for a major government contractor, they use MOSS, she has nothing but bad things to say about it.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40304399
Nobody has good things to say about SharePoint except MS.
For them, 'It's a growing billion dollar division!'
But for most folks who are in that hell, this site isn't full of jokes
http://paulswider.com/sharepoint-jokes/
It's full of bitter observations of their everyday reality
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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 specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

722 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