注册 登录
Office中国论坛/Access中国论坛 返回首页

的个人空间 http://www.office-cn.net/?0 [收藏] [复制] [分享] [RSS]

日志

报表奇偶分页打印

已有 2001 次阅读2008-4-26 10:33 |个人分类:Access

'
'--------------------------------------------------------------------------
'-功能描述:     对报表进行奇偶分页打印
'-输入参数说明: 参数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 编辑 ]

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-2 13:06 , Processed in 0.058879 second(s), 14 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

返回顶部