Bob Gajewski
bob at renaissancesiding.com
Tue Apr 15 08:46:24 CDT 2003
Frank
You didn't indicate whether you wanted to color the text or the background, so here's a few choices:
If you want to color the whole detail section:
===========================================
Const lngColorWhite = 16777215
Const lngColorGreen = 32768
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Left(Me.txtTelNbr,3) = "800" Or _
Left(Me.txtTelNbr,3) = "866" Or _
Left(Me.txtTelNbr,3) = "877" Or _
Left(Me.txtTelNbr,3) = "888" Then
Me.Section(0).BackColor = lngColorGreen
Else
Me.Section(0).BackColor = lngColorWhite
End If
End Sub
===========================================
If you want to place a highlight text box behind any or all of the detail line:
Create the unbound text box; make it green (or whatever).
===========================================
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Me.txtTelNbrHighlight = ""
Me.txtTelNbrHighlight.Visible = False
If Left(Me.txtTelNbr,3) = "800" Or _
Left(Me.txtTelNbr,3) = "866" Or _
Left(Me.txtTelNbr,3) = "877" Or _
Left(Me.txtTelNbr,3) = "888" Then
Me.txtTelNbrHighlight = " "
Me.txtTelNbrHighlight.Visible = True
Else
Me.txtTelNbrHighlight = ""
Me.txtTelNbrHighlight.Visible = False
End If
End Sub
===========================================
If you want to change the color of the actual fields:
===========================================
Const lngColorBlack = 0
Const lngColorGreen = 32768
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Left(Me.txtTelNbr,3) = "800" Or _
Left(Me.txtTelNbr,3) = "866" Or _
Left(Me.txtTelNbr,3) = "877" Or _
Left(Me.txtTelNbr,3) = "888" Then
Me.txtTelNbr.ForeColor = lngColorGreen
(repeat for each field that you want changed)
Else
Me.txtTelNbr.ForeColor = lngColorBlack
(repeat for each field that you want changed)
End If
End Sub
===========================================
HTH,
Bob Gajewski
On Tuesday, April 15, 2003 09:07 AM, Frank Tanner III [SMTP:pctech at mybellybutton.com] wrote:
> I an writing a report that I want to color the detail
> line a different color based upon an "option" checkbox
> in a form. Basically, if a box is checked AND the
> criteria that the checkbox represents is present in
> the record, it changes the color of that line in the
> details
>
> For instance. If the checkbox is "flag toll-free
> numbers" and the record being displayed in the details
> contains "800" "888" "866" or "877" it will color the
> record green
>
> How can I do this? I actually have several different
> check boxes with different criteria, but I'd imagine
> once one is figured out, it will work the same for all
> of them
>
> Thank you for your assistance
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>