|
2#
楼主 |
发表于 2006-12-19 03:22:00
|
只看该作者
附上代码,望知道的朋友帮忙看看,谢谢.
Option Compare Database
Dim lngA As Long
Private Sub 主体_Print(Cancel As Integer, PrintCount As Integer)
lngA = lngA + 1
Dim lngRows As Long
Dim intAllRows As Integer '包括空行,完整的行数。
Dim objCtl As Control
lngRows = 31 '这个行数请调整到和你报表的行数减1。
If intAllRows = 0 Then
If txtTotGrp Mod lngRows = 0 Then
intAllRows = txtTotGrp
Else
intAllRows = (Fix(txtTotGrp / lngRows) + 1) * lngRows
End If
End If
Debug.Print intAllRows
If lngA <= txtTotGrp Then
For Each objCtl In Me.Section(0).Controls
If objCtl.ControlType = acTextBox Then
With objCtl
.Visible = True
End With
End If
Next objCtl
Else
If lngA = intAllRows + 1 Then lngA = 1
For Each objCtl In Me.Section(0).Controls
If objCtl.ControlType = acTextBox Then
With objCtl
.Visible = False
End With
End If
Next objCtl
'设置第一条记录要显示出来
If lngA = 1 Then
For Each objCtl In Me.Section(0).Controls
If objCtl.ControlType = acTextBox Then
With objCtl
.Visible = True
End With
End If
Next objCtl
End If
End If
'以下设定是否进入下一节
If txtTotGrp < intAllRows Then
If lngA < txtTotGrp Then
Me.NextRecord = True
ElseIf (lngA >= txtTotGrp And lngA < intAllRows) Then
Me.NextRecord = False
Else
Me.NextRecord = True
End If
Else
Me.NextRecord = True
End If
End Sub |
|