PC Review


Reply
Thread Tools Rate Thread

Is there a way to programmatically print only a single page of a R

 
 
ThriftyFinanceGirl
Guest
Posts: n/a
 
      14th Sep 2009
I would like to give my users a button that will print the summary page of a
report quickly (first Page only). Is there a way to programmatically print
only the first page of a report, transparently to the user?

I have seen the Docmd.PrintOut, however, I think that is only for forms and
datasheets...
 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      14th Sep 2009
"ThriftyFinanceGirl" <(E-Mail Removed)> wrote in
message news:9CF712A1-8AE9-4F46-B430-(E-Mail Removed)...
>I would like to give my users a button that will print the summary page of
>a
> report quickly (first Page only). Is there a way to programmatically
> print
> only the first page of a report, transparently to the user?
>
> I have seen the Docmd.PrintOut, however, I think that is only for forms
> and
> datasheets...



The help file does imply that, but it's wrong. Bear in mind, though, that
it will print out the active object, so you have to ensure that your report
is the active object.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
Reply With Quote
 
ThriftyFinanceGirl
Guest
Posts: n/a
 
      14th Sep 2009
Hmmmm... that will be tricky since I would open the report through a
procedure on a form.... any suggestions on that?

"Dirk Goldgar" wrote:

> "ThriftyFinanceGirl" <(E-Mail Removed)> wrote in
> message news:9CF712A1-8AE9-4F46-B430-(E-Mail Removed)...
> >I would like to give my users a button that will print the summary page of
> >a
> > report quickly (first Page only). Is there a way to programmatically
> > print
> > only the first page of a report, transparently to the user?
> >
> > I have seen the Docmd.PrintOut, however, I think that is only for forms
> > and
> > datasheets...

>
>
> The help file does imply that, but it's wrong. Bear in mind, though, that
> it will print out the active object, so you have to ensure that your report
> is the active object.
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      14th Sep 2009
"ThriftyFinanceGirl" <(E-Mail Removed)> wrote in
message news:0ED78E83-E54D-41F0-B61C-(E-Mail Removed)...
> Hmmmm... that will be tricky since I would open the report through a
> procedure on a form.... any suggestions on that?



You can do this:

DoCmd.OpenReport "YourReport", acViewPreview
DoCmd.PrintOut acPages, 1, 1
DoCmd.Close acReport, "YourReport", acSaveNo

That will show the report to the user momentarily, though, just long enough
to send it to the printer. If you don't want the user to see the report at
all, it will be a lot trickier.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
Reply With Quote
 
fredg
Guest
Posts: n/a
 
      14th Sep 2009
On Mon, 14 Sep 2009 08:11:01 -0700, ThriftyFinanceGirl wrote:

> I would like to give my users a button that will print the summary page of a
> report quickly (first Page only). Is there a way to programmatically print
> only the first page of a report, transparently to the user?
>
> I have seen the Docmd.PrintOut, however, I think that is only for forms and
> datasheets...


You are not correct regarding DoCmd.PrintOut.
It prints out whatever the active object is, so, if you have a command
button on your form and you wish to print out a report you must first
select the report, otherwise, by itself, you will print the form
because the form is the active object.

Just the first page?
The report is NOT open?

Code a command button on a form:

DoCmd.SelectObject acReport, "ReportName", True
DoCmd.PrintOut acPages, 1,1

If the Report is already open in Preview, change True to False.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
ThriftyFinanceGirl
Guest
Posts: n/a
 
      14th Sep 2009
That's what I was thinking. I think that I will just let them see a flash of
the report and be done with it! Sometimes you don't need to go overboard on
the programming! Thanks!

"Dirk Goldgar" wrote:

> "ThriftyFinanceGirl" <(E-Mail Removed)> wrote in
> message news:0ED78E83-E54D-41F0-B61C-(E-Mail Removed)...
> > Hmmmm... that will be tricky since I would open the report through a
> > procedure on a form.... any suggestions on that?

>
>
> You can do this:
>
> DoCmd.OpenReport "YourReport", acViewPreview
> DoCmd.PrintOut acPages, 1, 1
> DoCmd.Close acReport, "YourReport", acSaveNo
>
> That will show the report to the user momentarily, though, just long enough
> to send it to the printer. If you don't want the user to see the report at
> all, it will be a lot trickier.
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      14th Sep 2009
"fredg" <(E-Mail Removed)> wrote in message
news:do98qophaa6j$.1b9uidyh4w3ar$.(E-Mail Removed)...
>
> Just the first page?
> The report is NOT open?
>
> Code a command button on a form:
>
> DoCmd.SelectObject acReport, "ReportName", True
> DoCmd.PrintOut acPages, 1,1



The only problem with this, Fred, is that it will display the database
window/nav pane, even if the user has hidden it.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
Reply With Quote
 
Dale Fye
Guest
Posts: n/a
 
      14th Sep 2009
Wouldn't using the Echo method work, something like:

Public Sub EchoTest()

On Error GoTo ProcError

Application.Echo False
DoCmd.OpenReport "rptYourReport", acPreview
DoCmd.PrintOut acPages, 1, 1
DoCmd.Close acReport, "rptYourReport"

ProcExit:
Application.Echo True
Exit Sub
ProcError:
MsgBox Err.Number, Err.Description
Resume ProcExit

End Sub


----
HTH
Dale



"Dirk Goldgar" wrote:

> "ThriftyFinanceGirl" <(E-Mail Removed)> wrote in
> message news:0ED78E83-E54D-41F0-B61C-(E-Mail Removed)...
> > Hmmmm... that will be tricky since I would open the report through a
> > procedure on a form.... any suggestions on that?

>
>
> You can do this:
>
> DoCmd.OpenReport "YourReport", acViewPreview
> DoCmd.PrintOut acPages, 1, 1
> DoCmd.Close acReport, "YourReport", acSaveNo
>
> That will show the report to the user momentarily, though, just long enough
> to send it to the printer. If you don't want the user to see the report at
> all, it will be a lot trickier.
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      14th Sep 2009
"Dale Fye" <(E-Mail Removed)> wrote in message
news:78EBC707-0702-4088-B109-(E-Mail Removed)...
> Wouldn't using the Echo method work, something like:
>
> Public Sub EchoTest()
>
> On Error GoTo ProcError
>
> Application.Echo False
> DoCmd.OpenReport "rptYourReport", acPreview
> DoCmd.PrintOut acPages, 1, 1
> DoCmd.Close acReport, "rptYourReport"
>
> ProcExit:
> Application.Echo True
> Exit Sub
> ProcError:
> MsgBox Err.Number, Err.Description
> Resume ProcExit
>
> End Sub



I forgot all about that, Dale! I believe it would. The user would still
see the "Printing ..." dialog, but not the report's print-preview window.
Good thinking!

The MsgBox in your error-handler isn't quite right. You may want this
instead:

MsgBox Err.Description, vbExclamation, "Error " & Err.Number


--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
Reply With Quote
 
ThriftyFinanceGirl
Guest
Posts: n/a
 
      14th Sep 2009
Yep, that's what I was going to try...We'll see if it still recognizes the
focus even with the echo turned off. Great minds think alike!

"Dale Fye" wrote:

> Wouldn't using the Echo method work, something like:
>
> Public Sub EchoTest()
>
> On Error GoTo ProcError
>
> Application.Echo False
> DoCmd.OpenReport "rptYourReport", acPreview
> DoCmd.PrintOut acPages, 1, 1
> DoCmd.Close acReport, "rptYourReport"
>
> ProcExit:
> Application.Echo True
> Exit Sub
> ProcError:
> MsgBox Err.Number, Err.Description
> Resume ProcExit
>
> End Sub
>
>
> ----
> HTH
> Dale
>
>
>
> "Dirk Goldgar" wrote:
>
> > "ThriftyFinanceGirl" <(E-Mail Removed)> wrote in
> > message news:0ED78E83-E54D-41F0-B61C-(E-Mail Removed)...
> > > Hmmmm... that will be tricky since I would open the report through a
> > > procedure on a form.... any suggestions on that?

> >
> >
> > You can do this:
> >
> > DoCmd.OpenReport "YourReport", acViewPreview
> > DoCmd.PrintOut acPages, 1, 1
> > DoCmd.Close acReport, "YourReport", acSaveNo
> >
> > That will show the report to the user momentarily, though, just long enough
> > to send it to the printer. If you don't want the user to see the report at
> > all, it will be a lot trickier.
> >
> > --
> > Dirk Goldgar, MS Access MVP
> > Access tips: www.datagnostics.com/tips.html
> >
> > (please reply to the newsgroup)
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 - Print a single page of a multi-page email RudyR Microsoft Outlook Discussion 6 3rd Jun 2010 11:28 AM
How to Print varied page numbers in a single print job without col Don M. Microsoft Excel Programming 2 18th Oct 2008 12:12 AM
Problems with print preview and printing single page of multi-page report w/sub-reports Tony Microsoft Access Reports 0 8th Oct 2007 07:19 PM
Set Print Page height programmatically? Duong Nguyen Microsoft Dot NET Framework Forms 2 20th Nov 2006 10:10 PM
How to print HTML-page programmatically without promting Print dialog? Sergey Goncharov Windows XP Internet Explorer 1 13th Jul 2004 06:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:33 PM.