PrtMip Property Example

The following PrtMip property example demonstrates how to set up the report with two horizontal columns.

Type str_PRTMIP
    strRGB As String * 28
End Type
Type type_PRTMIP
    xLeftMargin As Long
    yTopMargin As Long
    xRightMargin As Long
    yBotMargin As Long
    fDataOnly As Long
    xWidth As Long
    yHeight As Long
    fDefaultSize As Long
    cxColumns As Long
    yColumnSpacing As Long
    xRowSpacing As Long
    rItemLayout As Long
    fFastPrint As Long
    fDatasheet As Long
End Type

Sub PrtMipCols(strName As String)
    Dim PrtMipString As str_PRTMIP
    Dim PM As type_PRTMIP
    Dim rpt As Report
    Const PM_HORIZONTALCOLS = 1953
    Const PM_VERTICALCOLS = 1954
    DoCmd.OpenReport strName, acDesign
    Set rpt = Reports(strName)
    PrtMipString.strRGB = rpt.PrtMip
    LSet PM = PrtMipString
    ' Create two columns.
    PM.intColumns = 2
    ' Set 0.25 inch between rows.
    PM.intRowSpacing = 0.25 * 1440
    ' Set 0.5 inch between columns.
    PM.intColumnSpacing = 0.5 * 1440
    PM.intItemLayout = PM_HORIZONTALCOLS
    
    LSet PrtMipString = PM            ' Update property.
    rpt.PrtMip = PrtMipString.strRGB
End Sub

The next PrtMip property example shows how to set all margins to 1 inch.

Sub SetMarginsToDefault(strName As String)
    Dim PrtMipString As str_PRTMIP
    Dim PM As type_PRTMIP
    Dim rpt As Report
    DoCmd.OpenReport strName, acDesign
    Set rpt = Reports(strName)
    PrtMipString.strRGB = rpt.PrtMip
    LSet PM = PrtMipString
    PM.intLeftMargin = 1 * 1440    ' Set margins.
    PM.intTopMargin = 1 * 1440
    PM.intRightMargin = 1 * 1440
    PM.intBotMargin = 1 * 1440
    LSet PrtMipString = PM            ' Update property.
    rpt.PrtMip = PrtMipString.strRGB
End Sub