file:///d:/000.jpg不满一页空行代替代码如下:
Option Compare Database
Dim lngA As Long
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
lngA = lngA + 1
Dim lngRows As Long
Dim intAllRows As Integer '包括空行,完整的行数。
Dim objCtl As Control
lngRows = 39 '这个行数请调整到和你报表的行数减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
主体里有个叫txtTotGrp的文本框,它的数据来源=count(*),主体中所有字段都穿着一层标签外衣,外衣的border style=solid