Results 1 to 12 of 12
  1. #1
    New Lounger
    Join Date
    Apr 2002
    Location
    Columbus, Ohio, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SetReportSize (Access 2k)

    Good morning all: Does anyone have any information regarding SetReportSize and parameters/arguments it requires? TIA.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: SetReportSize (Access 2k)

    It isn't built into Access far as I know. Where did you run across it?
    Charlotte

  3. #3
    New Lounger
    Join Date
    Apr 2002
    Location
    Columbus, Ohio, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetReportSize (Access 2k)

    Charlotte: I inherited a system with SetReportSize as a function/procedure in an OnClick event of a button. Code is as follows:

    Private Sub cmd_all_Click
    Dim rptName as String
    Dim rptSize as Integer
    Dim rptOrientation as Integer

    rptName = "Parking Permit Report"
    rptSize = 17 '1-letter, 5-legal, 17-11x17
    rptOrientation = 2 '1-portrait,2-landscape

    SetReportSize rptName, rptSize, rptOrientation
    End Sub

    Was wondering if there were any more arguments/parameters, such as setting margins, etc.

    Thanks for responding.

  4. #4
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Wellington, New Zealand
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetReportSize (Access 2k)

    I recon that the SetReportSize must have been a custom function that someone built.

    What happends when you position the curson inside the word SetReportSize and hold down SHIFT and press F2.

    Does it take you to the function?

  5. #5
    New Lounger
    Join Date
    Apr 2002
    Location
    Columbus, Ohio, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetReportSize (Access 2k)

    Jayden: Thanks much. I never even thought to check for a custom function.

  6. #6
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Wellington, New Zealand
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetReportSize (Access 2k)

    No Problem

    I gather that you found the function?

  7. #7
    New Lounger
    Join Date
    Apr 2002
    Location
    Columbus, Ohio, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetReportSize (Access 2k)

    Yes. Should have look a little harder. Thanks again.

  8. #8
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Wellington, New Zealand
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetReportSize (Access 2k)

    Just me being pedantic but how about making your code more readable by using constants
    <pre>Private Sub cmd_all_Click
    Dim rptName as String
    Dim rptSize as Integer
    Dim rptOrientation as Integer

    const conLetter as integer = 1 'Paper Size Letter
    const conLegal as integer = 5 'Paper Size Legal
    const con11x17 as integer = 17 'Paper Size 11 x 17

    const conPortraint as integer = 1 'Portraint Orientation
    const conLandscape as integer = 2 'Landscape Orientation

    rptName = "Parking Permit Report"
    rptSize = con11x17
    rptOrientation = conLandscape

    SetReportSize rptName, rptSize, rptOrientation
    End Sub
    </pre>


    You could even get real flash and make the constants global so you can use them from any procedure (not just this one)?

    Just my <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15>.

  9. #9
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Wellington, New Zealand
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetReportSize (Access 2k)

    Well okay, maybe it doesn't look more readable here....but I'm sure it would in the VBA Window [img]/forums/images/smilies/smile.gif[/img]

  10. #10
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetReportSize (Access 2k)

    Hi Bill

    Could you post the SetReportSize custom function?

    Thanks. John

  11. #11
    New Lounger
    Join Date
    Apr 2002
    Location
    Columbus, Ohio, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SetReportSize (Access 2k)

    John: Here it is. Plus the TYPE definitions, etc. that go along with it. Good luck.

    Option Compare Database
    Option Explicit

    Public CurrentStreet
    Public CurrentZip
    Public CurrentAddress

    Type str_DEVMODE
    RGB As String * 94
    End Type

    Type type_DEVMODE
    strDeviceName As String * 16
    intSpecVersion As Integer
    intDriverVersion As Integer
    intSize As Integer
    intDriverExtra As Integer
    lngFields As Long
    intOrientation As Integer
    intPaperSize As Integer
    intPaperLength As Integer
    intPaperWidth As Integer
    intScale As Integer
    intCopies As Integer
    intDefaultSource As Integer
    intPrintQuality As Integer
    intColor As Integer

    intDuplex As Integer
    intResolution As Integer
    intTTOption As Integer
    intCollate As Integer
    strFormName As String * 16
    lngPad As Long
    lngBits As Long
    lngPW As Long
    lngPH As Long
    lngDFI As Long
    lngDFr As Long
    End Type

    Function SetReportSize(rptName As String, rptPaper As Integer, rptOrientation As Integer)
    Dim DevString As str_DEVMODE
    Dim DM As type_DEVMODE
    Dim strDevModeExtra As String
    Dim rpt As Report
    Dim intResponse As Integer
    ' Opens report in Design view.
    DoCmd.OpenReport rptName, acViewDesign

    Set rpt = Reports(rptName)
    If Not IsNull(rpt.PrtDevMode) Then
    strDevModeExtra = rpt.PrtDevMode ' Gets current DEVMODE structure.
    DevString.RGB = strDevModeExtra
    LSet DM = DevString

    DM.intPaperSize = rptPaper ' 1-letter, 5-legal, 17- 11x17
    DM.intOrientation = rptOrientation '1 - portrait, 2 - landscape

    LSet DevString = DM
    Mid(strDevModeExtra, 1, 94) = DevString.RGB
    rpt.PrtDevMode = strDevModeExtra
    DoCmd.Save

    DoCmd.OpenReport rptName, acViewPreview
    End If
    End Function

  12. #12
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: SetReportSize (Access 2k)

    This is pretty standard PrtDevMode usage. If you rummage in the help files, you'll find other examples of its use, and there are samples of other uses here in the Lounge if you search the Access forum on PrtDevMode.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •