473,326 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

how to print the last page

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
Nov 29 '07 #1
3 4477
On Nov 29, 3:07 am, "BzyQ" <mmbako...@neostrada.plwrote:
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.
Nov 29 '07 #2
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
Nov 29 '07 #3

Uzytkownik "fredg" <fg******@example.invalidnapisal w wiadomosci
news:1o*****************************@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
Nov 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: weiwei | last post by:
HI I am having a problem with print friendly function with asp, I have download some code regard with print friendly, it works fine with static html information, however, I have the dynamic pages...
1
by: Stan Brown | last post by:
On every page I have a <p ID="URhere"> that appears only when you print. (It's "display:none" in the general style sheet.) It would be nice if I could suggest that the browser print it at the...
0
by: magic man | last post by:
I have written an application in VB.Net using server side controls. I realize that I need client side controls to print anything at the clients computer. I have a web page that consists of a 1...
24
by: Rhino | last post by:
I am dabbling with print CSS for the first time and I need some guidance. The web pages on my site look fine - to my untrained eye - when displayed on the monitor in any of the standard browsers....
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
0
by: ShaneO | last post by:
There have been similar questions raised in the past, however no answers seem to have been provided, so I thought I'd give it a go. Scenario 1: My Windows Forms app generates (say) 10 pages in a...
7
by: =?gb2312?B?yMvR1MLkyNXKx8zs0cSjrM37vKvM7NHEsru8+7z | last post by:
Who could explain the follow issue ? ¦¤ Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeEncodeError: 'gbk' codec can't encode character u'\x80' in position 0: il...
2
by: dmorand | last post by:
When I try to print a 'print version' of my page it looks fine in IE 7, but when I print in IE 6 the margins are all screwed up. The page itself looks the same in both browsers, it's just when I...
0
by: tvnaidu | last post by:
I wrote a status page HTML code, here I have 8 port status, it prints first 7 and last status it won't print, from there onwards it won't print footer also, if I make 10 instead 8, then it prints...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.