Access报表打印——自动分页

Access报表打印——自动分页

|

问题:

每页打印一定行数后自动分页

方法一:

| 加一个分页符,在报表的代码界面里面写入以下代码:
| Option __ Compare __ Database
Dim __ row __ As __ Long
Dim __ RowsInPage __ As __ Integer
Private __ Sub __ 主体_Format(Cancel __ As __ Integer, __ FormatCount __ As __ Integer)
__ __ __ __ RowsInPage __ = __ 7
__ __ __ __ row __ = __ row __ + __ 1
__ __ __ __ If __ row __ >= __ RowsInPage __ Then
__ __ __ __ __ __ __ __ Me.PageBreak18.Visible __ = __ True
__ __ __ __ __ __ __ __ row __ = __ -1
__ __ __ __ Else
__ __ __ __ __ __ __ __ Me.PageBreak18.Visible __ = __ False
__ __ __ __ End __ If
End __ Sub

方法二:

| 在报表的代码界面里面写入以下代码:
| Option __ Compare __ Database
Dim __ row __ As __ Long
Private __ Sub __ 主体_Format(Cancel __ As __ Integer, __ FormatCount __ As __ Integer)
__ __ __ __ row __ = __ row __ + __ 1
__ __ __ __ If __ Me.Section(acDetail).ForceNewPage __ = __ 1 __ Then
__ __ __ __ __ __ __ __ Me.Section(acDetail).ForceNewPage __ = __ 0
__ __ __ __ Else
__ __ __ __ __ __ __ __ If __ row __ Mod __ 7 __ = __ 0 __ Then
__ __ __ __ __ __ __ __ __ __ __ __ Me.Section(acDetail).ForceNewPage __ = __ 1
__ __ __ __ __ __ __ __ __ __ __ __ row __ = __ 0
__ __ __ __ __ __ __ __ End __ If
__ __ __ __ End __ If
End __ Sub

例子下载:
http://access911.net/down/ForceNewPage.rar

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus