Need docmd code to display multiple pages of report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
Bartman said:
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.


DoCmd.RunCommand acCmdPreviewTwoPages
 
Marshall Barton said:
DoCmd.RunCommand acCmdPreviewTwoPages

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.
 
Bartman said:
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.
 
Back
Top