p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   Command Button to Print in Landscape Orientation (http://p2p.wrox.com/showthread.php?t=252)

brlevy June 6th, 2003 12:04 PM

Command Button to Print in Landscape Orientation
If someone could tell me exactly how to make a command button that prints the page in landscape on one click, that'd be great.


sherr8 June 6th, 2003 12:50 PM

I got this from google.com what you can do is adjust the margins see if that works. Go to Tools/Options and then the General Tab.


sherr8 June 6th, 2003 12:56 PM

Check this one out...

>-----Original Message-----
>I have a button on my form that when clicked will use the 'PrintOut' macro
>to print a query.
>Is there an extra bit of code I can run that will make the query print in
>landscape instead of portrait?
Look up the "PrtDevMode Property" in Access 2K help. Click
on "Example" and see if this will help. I use the Sub
SwitchOrient in my VB code for switching from portrait to
landscape on reports and it works nicely.

You have to place the Type statements and the SwitchOrient
sub (included in Example) in your Standard module.

Then I use a commandbutton on the form that runs the
report. This allows the user to switch from portrait to
landscape by pressing the commandbutton called SwitchView.
Module code for this is:

Private Sub SwitchView_Click()
On Error GoTo Err_SwitchView_Click

    SwitchOrient "MyReport"

    Exit Sub

    MsgBox Err.description
    Resume Exit_SwitchView_Click

End Sub



SerranoG June 9th, 2003 11:59 AM

If you're talking about a report, then the following will spit out your report in Landscape view without a preview. You'll probably have to tweak it to fit your variables, etc.

    Dim strPrinter As String
    Dim rptReport As Report, strReport as String

    strPrinter = Application.Printer.DeviceName
    strReport = "MyReport"

    DoCmd.OpenReport strReport, acViewPreview, , , acHidden

    Set rptReport = Reports(strReport)
    Set rptReport.Printer = Application.Printers(strPrinter)

    rptReport.Printer.Orientation = acPRORLandscape
    'Set it to acPRORPortrait for portrait.

    DoCmd.OpenReport strReport, acViewNormal
    DoCmd.Close acReport, strReport

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division

All times are GMT -4. The time now is 11:27 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.