'
'--------------------------------------------------------------------------
'-功能描述: 对报表进行奇偶分页打印
'-输入参数说明: 参数1: 必选 RptName 报表名称
'-使用语法示例: PrintCatalogReport("报表名称")
'-作者;Grant
'-时间;2008-1-10
'-Email;20991943@qq,cin
'-QQ;20991943
'-网站;www.accessbbs.cn'-博客;http://www.accessbbs.cn/bbs/blog/?uid/3'-使用本模块时请勿删除本信息,此模块临时替网友写作,并未完善,日后补充
'---------------------------------------------------------------------------
Function PrintCatalogReport(RptName As String)
Dim Rpt As Report
Dim PagesCount, i As Long
Dim myPrompt As String
myPrompt = "请将出纸器中已打印好一面的纸取出并将其放回到送纸器中,然后按下""确定"",继续打印"
DoCmd.OpenReport RptName, acViewPreview
Set Rpt = Reports(0)
PagesCount = Rpt.Pages
If PagesCount = 0 Then
MsgBox "Microsoft Access 未发现任何可以打印的内容", 0 + 48
DoCmd.Close acReport, RptName
Exit Function
ElseIf PagesCount = 1 Then
MsgBox "Microsoft Access 只有一页何须麻烦", 0 + 48
DoCmd.PrintOut acPages, 1, 1
Exit Function
End If
For i = 1 To PagesCount Step 2 '打印奇数页
DoCmd.PrintOut acPages, i, i
Next i
MsgBox myPrompt, 0 + 48
For i = 2 To PagesCount Step 2 '打印偶数页
DoCmd.PrintOut acPages, i, i
Next i
DoCmd.Close acReport, RptName
End Function
[
本帖最后由 Grant 于 2008-1-12 12:32 编辑 ]