問題:
每頁打印一定行數後自動分頁
方法一:
加一個分頁符,在報表的代碼界面裡面寫入以下代碼:
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