Matt said:
Can i set my command button print in landsape as i dont want to set the
printer defaults to landscape as other printouts are in portrait format.
Search in the help files for the PrtDevMode property. Here's some code from
earlier version helpfiles that does what you want:
The following example shows how to change the orientation of the report.
This example will switch the orientation from portrait to landscape or
landscape to portrait depending on the report's current orientation.
Sub SwitchOrient(strName As String)
Const DM_PORTRAIT = 1
Const DM_LANDSCAPE = 2
Dim DevString As str_DEVMODE
Dim DM As type_DEVMODE
Dim strDevModeExtra As String
Dim rpt As Report
DoCmd.OpenReport strName, acDesign ' Opens report in Design view.
Set rpt = Reports(strName)
If Not IsNull(rpt.PrtDevMode) Then
strDevModeExtra = rpt.PrtDevMode
DevString.RGB = strDevModeExtra
LSet DM = DevString
DM.lngFields = DM.lngFields Or DM.intOrientation ' Initialize fields.
If DM.intOrientation = DM_PORTRAIT Then
DM.intOrientation = DM_LANDSCAPE
Else
DM.intOrientation = DM_PORTRAIT
End If
LSet DevString = DM ' Update property.
Mid(strDevModeExtra, 1, 94) = DevString.RGB
rpt.PrtDevMode = strDevModeExtra
End If
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access