changing color of record

A

Amir

Hi,
i would like to change color of record(or a specific
textbox)if the right conditions are met. For example; i
would like to highlight a record that repeats if FullName
and DateWorked are found twice on same report. in other
words If for John Doe there are two records for one day I
would like to highlight one or both records, which ever is
possible. the report is formated as following; FullName is
in Header and DateWorked is in detail section with some
other info like annualhours, sick,....If I can highlight a
whole record(s) that is great if not maybe just a date
field....
 
K

Kelly

See "conditional formatting" and build expression to do what you need. Use the "Format" that is on the top grey bar when you have your control selected.
 
M

Marshall Barton

Amir said:
i would like to change color of record(or a specific
textbox)if the right conditions are met. For example; i
would like to highlight a record that repeats if FullName
and DateWorked are found twice on same report. in other
words If for John Doe there are two records for one day I
would like to highlight one or both records, which ever is
possible. the report is formated as following; FullName is
in Header and DateWorked is in detail section with some
other info like annualhours, sick,....If I can highlight a
whole record(s) that is great if not maybe just a date
field....


Create a group level for the DateWorked field add a header
section for this group and make it invisible. Place a text
box named txtDateCount in the header and set its control
source expression to =Count(*). This allows the header's
event procedures to determine how many details have the same
date.

Now add code to the header section's Format event to set the
detail control's color:

If Me.txtDateCount > 1 Then
Me.detailtextbox1.ForeColor = vbGreen
Me.detailtextbox2.ForeColor = vbGreen
. . .
Else
Me.detailtextbox1.ForeColor = vbBlack
Me.detailtextbox2.ForeColor = vbBlack
. . .
End If
 
A

Amir

thank you,
I will try that tommorow.
-----Original Message-----



Create a group level for the DateWorked field add a header
section for this group and make it invisible. Place a text
box named txtDateCount in the header and set its control
source expression to =Count(*). This allows the header's
event procedures to determine how many details have the same
date.

Now add code to the header section's Format event to set the
detail control's color:

If Me.txtDateCount > 1 Then
Me.detailtextbox1.ForeColor = vbGreen
Me.detailtextbox2.ForeColor = vbGreen
. . .
Else
Me.detailtextbox1.ForeColor = vbBlack
Me.detailtextbox2.ForeColor = vbBlack
. . .
End If
 
Top