pop up report in printpreview zoom

Wysy

Registered User.
Local time
Today, 11:40
Joined
Jul 5, 2015
Messages
333
Hi,
I have a button to bring up a report in a pop up mode (acDialog). However i need always need to click on the report itself to zoom in. Is there a way to do it via VBA i.e upon opening it zooms itself?
thank you
 
Add the following code to the open event of the report
Code:
DoCmd.Maximize
 
unfortunately it does not work, it keeps the same status.
 
try this way (open event)

Code:
DoCmd.OpenReport "report name", acViewPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdZoom100

You can change the value of 100
 
Fails regardless where i put the code:right after the openreport command or on the open event of the report: command not available
 
I'm sorry, I guess I misdirected you with the information I gave. Type the following code on the command button that opens the report on your form and it will be fixed. If you want it to fill the full screen
Code:
Private Sub cmdPreview_Click()
   DoCmd.OpenReport "CounterInformation", acViewPreview
   DoCmd.Maximize
   DoCmd.RunCommand acCmdFitToWindow
   ' DoCmd.RunCommand acCmdZoom150
End Sub


If you want to make the command 150%
Code:
DoCmd.RunCommand acCmdZoom150
you should patch like this.
 
you can also add code to the Open Event of the Report itself:

Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
End Sub
 
i have tried the docmd.maximize but it does not work. Report opens as before
 
i have tried the docmd.maximize but it does not work. Report opens as before

Just use code similar to that in post #6 but omit DoCmd.Maximize as its redundant here
e.g. on the print button in the calling form, use

Code:
Private Sub cmdPrint_Click()

    DoCmd.OpenReport "YourReportName", acViewPreview

   'then use ONE of the various alternatives including
    DoCmd.RunCommand acCmdZoom100
   ' DoCmd.RunCommand acCmdZoom150
   ' DoCmd.RunCommand acCmdZoom200
   ' DoCmd.RunCommand acCmdZoom500
   ' DoCmd.RunCommand acCmdFitToWindow
   ' DoCmd.RunCommand acCmdPreviewOnePage
   ' DoCmd.RunCommand acCmdPreviewTwoPages
   ' DoCmd.RunCommand acCmdPreviewFourPages
   ' etc
   
End Sub
 
thanks for all the input it works perfectly if report opened in a normal way. However if opened as a popup (acDialog) it does not work. Can it be that there is no solution for that?
 
Using acDialog overrides any other code used including hiding the print preview ribbon

If you really want it to be a popup, set the popup property to Yes.
It will then use the specified display setting e.g. DoCmd.RunCommand acCmdPreviewTwoPages . . .but the preview ribbon will again not appear
 
I have tried but it does not work. Anyway thank you for all help! I think i can live with this one more click to zoom in. Thanks again.
 
I have tried but it does not work. Anyway thank you for all help! I think i can live with this one more click to zoom in. Thanks again.
I have used the code supplied in post #12 for almost 20 years. I know it works ... that is providing you aren't using acDialog.
Frankly I see no possible reason for ever using PrintPreview and acDialog at the same time
 
I am using an x230 thinkpad on the go and because of the small screen, i thought of a "better" view of the report which only serves a fast data control.
 

Users who are viewing this thread

Back
Top Bottom