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

Need docmd code to display multiple pages of report

118 views
Skip to first unread message

Bartman

unread,
Jan 6, 2005, 3:43:03 PM1/6/05
to
I am opening a report, maximizing it, and fitting it in the window with the
following code:

DoCmd.OpenReport "rptReportName", acViewPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdFitToWindow

This report usually has two pages. Does anyone know of a way to display
both pages? (Another RunCommand perhaps?) Once the report is open, I can
right click, select Multiple Pages (1x2 pages) and it displays them side by
side but I need a way to programmatically display both pages so a can pop up
a msgbox for my users to accept to generate additional code. Thank you for
any advice.

Marshall Barton

unread,
Jan 6, 2005, 6:41:35 PM1/6/05
to
Bartman wrote:


DoCmd.RunCommand acCmdPreviewTwoPages

--
Marsh
MVP [MS Access]

Bartman

unread,
Jan 7, 2005, 9:13:01 AM1/7/05
to
"Marshall Barton" wrote:

Thanks Marsh,

Can you advise from an efficiency standpoint the order of these commands:

DoCmd.OpenReport "rptReportName", acViewPreview
DoCmd.Maximize

DoCmd.RunCommand acCmdPreviewTwoPages
DoCmd.RunCommand acCmdFitToWindow

I have over 500 reports and I would like to call the last three lines of
code everyime I open a report to reduce the amount of code. I don't know if
it matters but I convert this to mde that is used by hundreds of users so it
is very important that I use the most efficient order in my code. I ran a
timer but I didn't notice any difference but that was in my mdb with just one
user. Thanks.

Marshall Barton

unread,
Jan 7, 2005, 11:49:58 AM1/7/05
to
>> Bartman wrote:
>> >I am opening a report, maximizing it, and fitting it in the window with the
>> >following code:
>> >
>> > DoCmd.OpenReport "rptReportName", acViewPreview
>> > DoCmd.Maximize
>> > DoCmd.RunCommand acCmdFitToWindow
>> >
>> >This report usually has two pages. Does anyone know of a way to display
>> >both pages? (Another RunCommand perhaps?) Once the report is open, I can
>> >right click, select Multiple Pages (1x2 pages) and it displays them side by
>> >side but I need a way to programmatically display both pages so a can pop up
>> >a msgbox for my users to accept to generate additional code. Thank you for
>> >any advice.
>>
>"Marshall Barton" wrote:
>> DoCmd.RunCommand acCmdPreviewTwoPages

>>
>
Bartman wrote:
>Can you advise from an efficiency standpoint the order of these commands:
>
> DoCmd.OpenReport "rptReportName", acViewPreview
> DoCmd.Maximize
> DoCmd.RunCommand acCmdPreviewTwoPages
> DoCmd.RunCommand acCmdFitToWindow
>
>I have over 500 reports and I would like to call the last three lines of
>code everyime I open a report to reduce the amount of code. I don't know if
>it matters but I convert this to mde that is used by hundreds of users so it
>is very important that I use the most efficient order in my code. I ran a
>timer but I didn't notice any difference but that was in my mdb with just one
>user.


I don't think it matters. This is the way I would do it:


DoCmd.OpenReport "rptReportName", acViewPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdPreviewTwoPages

Note that the TwoPages automatically does the FitToWindow,
so you don't need that line at all.

0 new messages