how to print the last page
am 29.11.2007 10:07:05 von BzyQhi
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
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
On Nov 29, 3:07 am, "BzyQ"
> 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
Create a second report that outputs just the last page.
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"
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Uzytkownik "fredg"
news:1okggqv4vbr8t.1qu1l91o8doeb.dlg@40tude.net...
> 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