Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Print

0 views
Skip to first unread message

Preeti

unread,
Oct 11, 2009, 3:06:01 AM10/11/09
to
How to bring up page setup dialog box before printing a report?

Ralph

unread,
Oct 11, 2009, 1:09:39 PM10/11/09
to

"Preeti" <Pre...@discussions.microsoft.com> wrote in message
news:9E719F2D-5E20-46DA...@microsoft.com...

> How to bring up page setup dialog box before printing a report?

You can use ....

"How To Open the Printer Properties Dialog"
http://support.microsoft.com/kb/198860

However, while this example shows how to display a dialog for all available
printers, this will not work for DataReport. The DataReport uses only the
"Default Printer". You will need to modify the sample to select and open
only the default printer.

Again, selecting a different printer, changing its properties, and then
attempting to print to that printer - WILL NOT WORK.

Thus also, you can not use any of the Printer APIs or the Printer Object.
This works for the Application but is ignored by the DataReport.

You can allow the user to change the default printer before initializing the
report by using the common dialog.

CmnDlg.ShowPrinter

But note this changes the default printer for ALL apps. So you will need to
call this again for the user to set the "default printer" back. This is a
major failing of the DataReport in my opinion.

-ralph


Preeti

unread,
Oct 12, 2009, 2:07:01 AM10/12/09
to
No i wanted to set the page margins so is there a way to pop up page set up
dialog box not necessarily in data report. i can call it from the form itself
from where i'm calling datareport.show

Ralph

unread,
Oct 12, 2009, 7:47:11 AM10/12/09
to

"Preeti" <Pre...@discussions.microsoft.com> wrote in message
news:D1E94292-B370-4C6C...@microsoft.com...

> No i wanted to set the page margins so is there a way to pop up page set
up
> dialog box not necessarily in data report. i can call it from the form
itself
> from where i'm calling datareport.show
>
> "Ralph" wrote:
>

I misunderstood you. I saw "page setup" and read "printer setup", and
confused your question with your next concerning topmargins for first and
subsequent pages.

[And the fact that problems with 'printing' and printers is usually the next
stubbling block for DataReport programmers. <g>]

You can not specifically set the DataReport margins for different pages, but
you can change the LeftMargin, RightMargin, TopMargin, and BottomMargin for
the whole report (as well as the size of the reports container) before
running it.
' uses twips
With dr
' the window
.Height = 12000
.Width = 12000
' the report
.TopMargin = 500
.BottomMargin = 500
.Caption = "My Report for " & CStr(Now())
.Show vbModal
End With

But note there is a flaw here. These settings affect how the report looks in
the container but often export poorly to other 'viewers' or when printed.
When exporting you will likely need to provide a "template" and do a little
trial 'n error.

hth
-ralph

0 new messages