Office中国论坛/Access中国论坛

标题: 一个简单的问题 [打印本页]

作者: oceanfloor    时间: 2003-3-7 00:44
标题: 一个简单的问题
下面是一个函数我想问一下left!,top!,right!,bottom!是什么数据类型,还有1440(inches)是多少毫米,或是多少厘米
'------------------------Function-----------------------------
Public Function SetReportMarginDefault(strReportName As String, left!, top!, right!, bottom!)
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
Dim objRpt As Report
Dim tempPrtMip As String

DoCmd.Echo False
DoCmd.OpenReport strReportName, acDesign
Reports(strReportName).Painting = False
Set objRpt = Reports(strReportName)

PrtMipString.RGB = objRpt.PrtMip

LSet PM = PrtMipString
'Use 1440 for US (inches), 567 (rest of the world) (centimeters)
PM.xLeftMargin = left * 1440
PM.yTopMargin = top * 1440
PM.xRightMargin = right * 1440
PM.yBottomMargin = bottom * 1440

LSet PrtMipString = PM

objRpt.PrtMip = PrtMipString.RGB

'Make sure report has the focus
DoCmd.SelectObject acReport, strReportName
'Save the Report
DoCmd.DoMenuItem 7, acFile, 4, , acMenuVer70

CloseRpt:
DoCmd.Close acReport, strReportName
DoCmd.Echo True
'You're done.

End Function



作者: oceanfloor    时间: 2003-3-7 16:56
怎么没有回答啊,我很急
作者: 大熊    时间: 2003-3-7 17:10
缇,1缇的长度等于1/1440英寸;1/567厘米;1/20磅
作者: oceanfloor    时间: 2003-3-7 17:27
什么是缇???
作者: Roadbeg    时间: 2003-3-7 17:28
vb 中的默认单位
作者: oceanfloor    时间: 2003-3-7 17:49
能告诉我这个函数怎么调用,怎么用参数
作者: 大熊    时间: 2003-3-7 17:58
Call SetReportMarginDefault(报表名, 左, 上, 右,下)

作者: eio    时间: 2003-3-7 18:35
无法使用,请大熊指教或做简单的实例。
作者: oceanfloor    时间: 2003-3-7 18:45
eio说的对我在调用也无法使用,请大熊多多指教
作者: 大熊    时间: 2003-3-7 20:03
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
你没抄来type,当然不能用。
作者: 大熊    时间: 2003-3-7 20:06
在模块前面补上试试,有问题再试。
Private Type str_PRTMIP
    strRGB As String * 28
End Type

Private 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

作者: oceanfloor    时间: 2003-3-7 21:06
我把抄来后,总是提示DoCmd.OpenReport strReportName, acViewDesign出错,请这是为何
作者: 大熊    时间: 2003-3-7 21:22
试了一下,没有问题,你退出ACCESS后再试试,我是在debug窗口直接调的,会不会你的报名已打开,或者你在MDE中用该语句。
ps.刚才的我传的TYPE定义与作者不一样,正确如下,这个该死的作者修改了微软给的属性名。

Private Type str_PRTMIP
'strRGB As String * 28
RGB As String * 28
End Type

Private Type type_PRTMIP
xLeftMargin As Long
yTopMargin As Long
xRightMargin As Long
yBottomMargin 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




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3