下面图老师小编跟大家分享一个简单易学的打印再添一例自动分页教程,get新技能是需要行动的,喜欢的朋友赶紧收藏起来学习下吧!
【 tulaoshi.com - 编程语言 】
问题:
每页打印一定行数后自动分页
方法一:
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)加一个分页符,在报表的代码界面里面写入以下代码:
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
来源:http://www.tulaoshi.com/n/20160219/1615381.html