|
你这是copy来的代码,对于你这种报表的实例不适用。关键在于你的记录有1、2、3条之分,不能用PrintCount来计数。请把下面的代码copy到你的报表中,这段代码没有测试过3条以上的记录,如果3条以上有问题,你可以根据1、2条记录的写法,自己改一下(在case else这段里面)。另外这个函数也不合适你的情况,改动了一下。Option Compare Database
Option Explicit
Dim intCount As IntegerPublic Function ForeColorSet(rpt As Report, Asbl As Boolean)
Dim ctl As Control
For Each ctl In rpt.Section(0).Controls
If TypeOf ctl Is TextBox Then
If Asbl Then
ctl.ForeColor = 16777215
Else
ctl.ForeColor = 0
End If
End If
Next ctl
End FunctionPrivate Sub Report_Open(Cancel As Integer)
intCount = 0
Call ForeColorSet(Me, False)
End SubPrivate Sub 主体_Print(Cancel As Integer, PrintCount As Integer)
Select Case Me.文本25
Case 1
intCount = intCount + 1
If intCount = 1 Then
Me.NextRecord = False
End If
If intCount > 1 Then
Me.NextRecord = False
Call ForeColorSet(Me, True)
End If
If intCount = 3 Then
Me.NextRecord = True
End If
If intCount > 3 Then Call ForeColorSet(Me, False)
Case 2
intCount = intCount + 1
If intCount = 2 Then
Me.NextRecord = False
End If
If intCount > 2 Then
Me.NextRecord = False
Call ForeColorSet(Me, True)
End If
If intCount = 3 Then
Me.NextRecord = True
End If
If intCount > 3 Then Call ForeColorSet(Me, False)
Case Else
intCount = intCount + 1
If intCou |
|