• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

Surpressing blank page

Hi All,
A new clients database (built by another and not very well but, its what I have to work with) has bound forms that display customer information and when printed, is three pages long. The information on page 3 is set to screen display only. When printing it prints 3 pages with the last
page being a blank page. I have tried to surpress the third page by putting a print button on the form and adding the vba code -
Docmd.Printout acPages, 1, 2 which does Not work.

The Docmd.Printout acPages, 1, 2  actually prints page 1 and 2 of record 1, not the currently displayed records, which I don't understand. Again, the form is a bound form and so the user uses the record selector to go to the record of choice and then wants page 1 and 2 of the displayed record printed.

I have tried several things and can't seem to find the right
combination to get it working correctly, I've tried such things like
Me.Refresh
Docmd.Printout acPages, 1, 2  'prints page 1 and 2 of record 1 not currently displayed record

Me.Requery
Docmd.Printout acPages, 1, 2  'prints page 1 and 2 of record 1 not currently displayed record

DoCmd.RunCommand acCmdSelectRecord
DoCmd.PrintOut acSelection  'still prints third page which is blank

DoCmd.RunCommand acCmdSelectRecord
Docmd.Printout acPages, 1, 2  'prints page 1 and 2 of record 1 not currently displayed record

So, how do I get Only page 1 and 2 of the current record that's being displayed on the screen printed??? Creating reports for these forms is not an option, there are 10 of these forms with many, many controls on them and I don't think this client would want to pay for the creation of 10 reports just to surpress the printing of a blank page.

thanks
bobh.

0
bhynes
Asked:
bhynes
  • 2
1 Solution
 
Arthur_WoodCommented:
when the screen is printed, you essentially have no further control over how many 'pages' are going to be actually printed.  What you are asking is not possible.  The DoCmd.PrintOut command  is used to print reports, and does not affect what happens with PrintScreen.  If you want to be able to provide the client with Printed ouptput, the best approach is to design a REPORT to print the formatted data, and NOT to use PrintScreen.

AW
0
 
harfangCommented:
Hello bhynes

Although forms do not have all features of reports, they have some. For example, there is the "dispay when property", but there are also page headers and footers, page breaks and the CanGrow and CanShrink properties, along with ForNewPage, NewRowOrCol, KeepTogether for sections.

When a control with DisplayWhen:Screen is printed, it is essentially hidden. If it also has CanShrink:Yes, the controls below will move up to occupy that space. Finally, if the section has CanShrink:Yes, it will, well, shrink by the ammount of all hidden, not printed, or Null controls, having that same setting.

Using that, I'm certain that you will be able to reclaim the wasted space and shrink the printed ouptut to two pages.

> I don't think this client would want to pay for the creation of 10 reports

That would be what, one hour? Breaks down to:
* select form, choose "file / save as", As: Report (5 seconds)
* adjust the two or three properties or event events handlers not available for forms (5 minutes)
* repeat 10 times (51 minutes.)

OK, you will want to use another hour to add "print" buttons to your forms and the like, but my point is that a report doing exactly what the printing of a form does takes 5 seconds to create.

Hope this gets you out of the woods!

(°v°)
0
 
bhynesAuthor Commented:
I have the controls that show on what would be page3 set to screen only but what I didn't think about was 'CanShrink' so, I'll play around with that in combination with all the other tweaks and adjustments I've done.
thanks
0
 
harfangCommented:
Glad to help, success with your client!
(°v°)
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now