我在本论坛搜索了有关话题,但是很多例子都看不明白。后来我自己做了一个,超简单!
特别感谢andymark,没有他,这个程序就行不通了。
'说明:必须在报表主体增加一个分页符(在工具箱),分页符名为:ageBreak9.
全部代码如下:
Option Compare Database
Dim aaa As Long ' 行数变量
'下面代码提示输入行数
rivate Sub Report_Open(Cancel As Integer)
aaa = InputBox("请输入固定的行数[试用建议1-6]", "请输入行数", 3)
End Sub
'下面代码实现分页
rivate Sub 主体_Format(Cancel As Integer, FormatCount As Integer)
If Me.counter Mod aaa = 0 Then '每隔aaa行分页
Me.PageBreak9.Visible = True
Else
Me.PageBreak9.Visible = False
End If
End Sub
'下面代码自动给表格加边框并换行
;Private Sub 主体_Print(Cancel As Integer, PrintCount As Integer)
Dim CtlDetail As Control
Dim intLineMargin As Integer
intLineMargin = 60
For Each CtlDetail In Me.Section(acDetail).Controls
With CtlDetail
If CtlDetail.ControlType <> acPageBreak Then
If CtlDetail.Name <> "Memo" Then
Me.Line ((.Left + .Width + intLineMargin), 1)-(.Left + .Width + _
intLineMargin, Me.Height)
End If
End If
End With
Next
With Me
Me.Line (1, 1)-Step(.Width, .Height), 1, B
End With
Set CtlDetail = Nothing
End Sub
[此贴子已经被作者于2006-11-22 19:03:06编辑过] |