Re: how to print the last page




Uzytkownik "fredg" <fgutkind@xxxxxxxxxxxxxxx> napisal w wiadomosci
news:1okggqv4vbr8t.1qu1l91o8doeb.dlg@xxxxxxxxxxxxx
On Thu, 29 Nov 2007 10:07:05 +0100, BzyQ wrote:

hi
how do I, in vba code, open a report by DoCmd.OpenReport in acViewNormal
mode and force it to print only the last page of it instead of the all
pages ?

BzyQ


Open it in acPreview, not in acNormal.

You can determine the last page of the report by including an unbound
control in the report's Page Footer section:
=[Pages]
or
="Page " & [Page] & " of " & [Pages]

If you don't wish to actually show the above control, just make it not
visible.

Then code a Command button click event on your form:

DoCmd.OpenReport "ReportName", acViewPreview, , , acHidden
DoCmd.SelectObject acReport, ReportName, False
DoCmd.PrintOut acPages, Reports!ReportName.[Pages],
Reports!ReportName.[Pages]
Docmd.close acReport, "ReportName"

Thanks !! that works perfect


.