G
Guest
I want to modify the backstyle and the Borderstyle properties of certain
controls on the detail line of a report depending on the value of a field. I
have tested the code (below) on both the Detail_Format and the Detail_Print
Event. In both cases the Me.Detail.Controls.Count is zero. Even though
their are 40 or 50 controls within the detail line of this report. Any
thoughts would be appreciated.
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim i As Integer
Dim stwk As String
For i = 0 To Me.Detail.Controls.Count - 1
stwk = Left(Me.Detail.Controls(i).Name, 17)
If stwk = "CurrYrFailureRate" Then
If Me.Detail.Controls(i).Value > 19.9 Then
Me.Detail.Controls(i).BackStyle = 0
Me.Detail.Controls(i).BorderStyle = 0
Else
Me.Detail.Controls(i).BackStyle = 1
Me.Detail.Controls(i).BorderStyle = 1
End If
End If
i = i + 1
Next
End Sub
controls on the detail line of a report depending on the value of a field. I
have tested the code (below) on both the Detail_Format and the Detail_Print
Event. In both cases the Me.Detail.Controls.Count is zero. Even though
their are 40 or 50 controls within the detail line of this report. Any
thoughts would be appreciated.
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim i As Integer
Dim stwk As String
For i = 0 To Me.Detail.Controls.Count - 1
stwk = Left(Me.Detail.Controls(i).Name, 17)
If stwk = "CurrYrFailureRate" Then
If Me.Detail.Controls(i).Value > 19.9 Then
Me.Detail.Controls(i).BackStyle = 0
Me.Detail.Controls(i).BorderStyle = 0
Else
Me.Detail.Controls(i).BackStyle = 1
Me.Detail.Controls(i).BorderStyle = 1
End If
End If
i = i + 1
Next
End Sub