Print Current Page

  • Thread starter Thread starter Connie
  • Start date Start date
C

Connie

Access 2000
Is there a built-in function or method that will print current page of a
report (btw, I'm not using Snapshot view). I'm creating a button &
assigning code to it to print current page. What I'm thinking of using is
the PrintOut Method, & retrieve current page number (if this is possible) &
then assign that to the PageFrom & PageTo. Before I tackle that I just
wanted to know if there is an easier or better way to approach this.

TIA
Connie
 
You can't put a button on a report. Please be more specific. Where will
this button be? On a form? If so, how would you know the "current page" of
the report?

If you are viewing a report, you can use the print dialog box to specify the
"current page"

Rick


Access 2000
Is there a built-in function or method that will print current page of a
report (btw, I'm not using Snapshot view). I'm creating a button &
assigning code to it to print current page. What I'm thinking of using is
the PrintOut Method, & retrieve current page number (if this is possible) &
then assign that to the PageFrom & PageTo. Before I tackle that I just
wanted to know if there is an easier or better way to approach this.

TIA
Connie
 
Sorry Rick, it's been one of those days where there's just not enough hrs. &
I guess I rushed with this question.

I'm planning on adding a button to a custom toolbar that'll be attached to a
report. The client would like to be able to just click a button to print
the current page they're viewing, without having to go into print dialog box
& enter From Page __ To Page __. I don't know if it's possible to retrieve
the page number they're currently on, but if so that's what I'd use with the
PrintOut Method. But before I did that, I wanted to see if there's a better
way to accomplish this.

Thanks
Connie
 
Ahhh. That makes sense (and is a great idea). I do not know how to do
that, but I'm sure an MVP will respond if there is a way. I would think you
might be able to tie a macro to the button, but I played around with that
and can't figure out how to carry the page into the dialog box.

I will be watching for the replay and might just do something similar for an
exception report that we view.

Rick


Sorry Rick, it's been one of those days where there's just not enough hrs. &
I guess I rushed with this question.

I'm planning on adding a button to a custom toolbar that'll be attached to a
report. The client would like to be able to just click a button to print
the current page they're viewing, without having to go into print dialog box
& enter From Page __ To Page __. I don't know if it's possible to retrieve
the page number they're currently on, but if so that's what I'd use with the
PrintOut Method. But before I did that, I wanted to see if there's a better
way to accomplish this.

Thanks
Connie
 
Hi Rick,

This is what I've done so far & it seems to be working, however I don't know
how to pass the name of report when user clicks on button, so I had to
hardcode the name of report. Maybe there's a way to do this so the code
could be used with any report.

In a module I created the following function ... (has to be a function to
assign to a button):

Function PrtCurrentPg()
Dim intCurrentPageNo

intCurrentPageNo = Reports!NameOfReport.Page
DoCmd.PrintOut acPages, intCurrentPageNo, intCurrentPageNo

End Function

To assign this to the button, go into the button's properties (have
Customize window open) & in the Action box type in the name of the function
(you won't see it in the list, so I generally copy & paste it here)

As soon as the user clicks the button the page is sent to the printer ....
you don't use the dialog box at all.
Hope this helps Rick.
 
Connie:

Wow! You are almost there. I bet someone will be able to answer you. One
way I could think of is to have the 'on open' event for the report store the
report name in a variable of a global function. Then pull that variable
into your code.

You could also have a hidden form with a single unbound tect box on it.
When you open a report, write the name to that text box. When you run your
code, pull the contents of the text box into your code as the report name.

I'm sure there are better ways to obtain the name of the open report. The
two methods I mentioned should work, but are not ver ellegant.

Thanks for passing on what you have done so far. I will start coding the
same in my database.

Rick


Hi Rick,

This is what I've done so far & it seems to be working, however I don't know
how to pass the name of report when user clicks on button, so I had to
hardcode the name of report. Maybe there's a way to do this so the code
could be used with any report.

In a module I created the following function ... (has to be a function to
assign to a button):

Function PrtCurrentPg()
Dim intCurrentPageNo

intCurrentPageNo = Reports!NameOfReport.Page
DoCmd.PrintOut acPages, intCurrentPageNo, intCurrentPageNo

End Function

To assign this to the button, go into the button's properties (have
Customize window open) & in the Action box type in the name of the function
(you won't see it in the list, so I generally copy & paste it here)

As soon as the user clicks the button the page is sent to the printer ....
you don't use the dialog box at all.
Hope this helps Rick.
 
Thank you so much knut, that took care of my problem!! However I couldn't
use the Name property as that returns a string & because I'm using the Page
property of the report object I tweaked it as follows: (Rick this may help
you as well)

Function PrtCurrentPg()
Dim intCurrentPageNo
Dim CurrentRptName As Report

Set CurrentRptName = Screen.ActiveReport
intCurrentPageNo = CurrentRptName.Page
DoCmd.PrintOut acPages, intCurrentPageNo, intCurrentPageNo

End Function


Thanks again knut, appreciate your help in finalizing this last part.
Connie
 
Back
Top