Color Fields on a Report when Conditions are met

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

I have a report that has the following
Phase1_Date, Phase2_Date, Phase3_Date, Phase4_Date, Phase5_Date
Phase1_ComplDate, Phase2_ComplDate, etc.

How do i get the report to color the Phase1_ComplDate using if then
statements?
If Phase1_ComplDate =< Phase1_Date Then
Phase1_ComplDate.BackColor = 65280 'Green
Else
Phase1_ComplDate.BackColor = 65535 'Yellow

I tried the conditional formatting, but it doesn't seem to work? I need it
to work for all 5 Phases independently.

Thanks
 
Use the Format event of the section the controls are in.
Don't forget the End If

With Me
If .Phase1_ComplDate =< .Phase1_Date Then
.Phase1_ComplDate.BackColor = 65280 'Green
Else
.Phase1_ComplDate.BackColor = 65535 'Yellow
End If
End Wit
 
I don't care much for your table structure (unless this is a crosstab result)
however conditional formatting should work. Are the fields actual dates or
are they text?

Are your control backgrounds set to transparent?
 
Not with 5 conditions, Duane.
Max (up to 2003) is 4 - 3 conditionals and default set in design view.
I don't know about 07 and OP did not state version.
 
I read the question as 2 coditions on each of 5 different controls. The 5
groups of repeating fields is the only issue I am finding with the table(s).
 
You are correct. I happened to think about it about 3:00AM this moring. One
of those wake up I thought of something moments.

The OP may not, as you originally thought, be setting the conditions
correctly.

To OP.
Your conditional formatting should be set on "Expression Is" rather than a
field value.
 
Back
Top