F
Fiona M
I have created the above module, using code from Microsoft, in Access 2003.
This is it:
Type str_PRTMIP
strRGB As String
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 SetMarginsToDefault(strName As String)
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
Dim rpt As Report
DoCmd.OpenReport strName, acViewDesign
Set rpt = Reports(strName)
PrtMipString.strRGB = rpt.PrtMip
LSet PM = PrtMipString
' set margins
PM.xLeftMargin = 1 * 1146
PM.yTopMargin = 1 * 1146
PM.xRightMargin = 1 * 850
PM.yBotMargin = 1 * 850
LSet PrtMipString = PM
rpt.PrtMip = PrtMipString.strRGB
DoCmd.Save
End Sub
When I compile it, I am getting an error "Type Mismatch" at the following
line.
LSet PM = PrtMipString
I've used this code previously and it has worked fine. Can anyone shed some
light on why I'm getting the compile error.
This is it:
Type str_PRTMIP
strRGB As String
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 SetMarginsToDefault(strName As String)
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
Dim rpt As Report
DoCmd.OpenReport strName, acViewDesign
Set rpt = Reports(strName)
PrtMipString.strRGB = rpt.PrtMip
LSet PM = PrtMipString
' set margins
PM.xLeftMargin = 1 * 1146
PM.yTopMargin = 1 * 1146
PM.xRightMargin = 1 * 850
PM.yBotMargin = 1 * 850
LSet PrtMipString = PM
rpt.PrtMip = PrtMipString.strRGB
DoCmd.Save
End Sub
When I compile it, I am getting an error "Type Mismatch" at the following
line.
LSet PM = PrtMipString
I've used this code previously and it has worked fine. Can anyone shed some
light on why I'm getting the compile error.