Form, Query, Report, Table.
You can use the PrtMip property in Visual Basic to set or return the device mode information specified for a form, report, or module in the Print Setup dialog box.
The PrtMip property setting is a 28-byte structure that maps to settings for the Margins options and the Data Only option for a form, report, or module in the Print Setup dialog box. The structure also maps to the options displayed after you choose the More button in the Print Setup dialog box. (The More button is enabled only for a form in Form view or a report.)
The PrtMip property uses the following members.
|
Member |
Description |
|
LeftMargin, RightMargin, TopMargin, BottomMargin |
An Integer that specifies the distance between the edge of the page and the item to be printed in twips. |
|
DataOnly |
An Integer that specifies the elements to be printed. When True (-1), prints only the data in a table or query in Datasheet view, form, or report, and suppresses labels, control borders, gridlines, and display graphics such as lines and boxes. When False (0), prints data, labels, and graphics. |
|
ItemsAcross |
An Integer that specifies the number of columns across for multiple-column reports or labels. |
|
RowSpacing |
An Integer that specifies the horizontal space between detail sections in units of 1/20 of a point. |
|
ColumnSpacing |
An Integer that specifies the vertical space between detail sections in twips. |
|
DefaultSize |
An Integer. When True, uses the size of the detail section in Design view. When False, uses the values specified by the ItemSizeWidth and ItemSizeHeight members. |
|
ItemSizeWidth |
An Integer that specifies the width of the detail section in twips. |
|
ItemSizeHeight |
An Integer that specifies the height of the detail section twips. |
|
ItemLayout |
An Integer that specifies horizontal (1953) or vertical (1954) layout of columns. |
|
FastPrint |
Reserved |
|
Datasheet |
Reserved |
The PrtMip property setting is read/write in Design view and read-only in other views.
PrtDevMode Property, PrtDevNames Property.
The following PrtMip property example demonstrates how to setup the report with 2 horizontal columns.
Type str_PRTMIP
RGB As String * 56Typetype_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 LongType
PrtMipCols(rptName 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 rptName, acDesign ' Open report in Design view.
Set rpt = Reports(rptName)
PrtMipString.RGB = rpt.PrtMip
LSet PM = PrtMipString
PM.cxColumns = 2 ' Create two columns.
PM.xRowSpacing = 0.25 * 1440 ' Set 0.25 inch between rows.
PM.yColumnSpacing = 0.5 * 1440 ' Set 0.5 inch between columns.
PM.rItemLayout = PM_HORIZONTALCOLS
LSet PrtMipString = PM ' Update property.
rpt.PrtMip = PrtMipString.RGBSub
The next PrtMip property example shows how to set all margins to 1 inch.
Sub SetMarginsToDefault(rptName As String)
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
Dim rpt As Report
DoCmd.OpenReport rptName, acDesign ' Open report in Design view.
Set rpt = Reports(rptName)
PrtMipString.RGB = rpt.PrtMip
LSet PM = PrtMipString
PM.xLeftMargin = 1 * 1440 ' Set margins.
PM.yTopMargin = 1 * 1440
PM.xRightMargin = 1 * 1440
PM.yBotMargin = 1 * 1440
LSet PrtMipString = PM ' Update property.
rpt.PrtMip = PrtMipString.RGBSub