Conditional Formatting based on field in report...

J

Juan Schwartz

I didn't see an option for this in the report design view... I saw you
could set a specific number, but I'm comparing field1 to field2 for the
condition. Is this possible?

I tried the following in VBA

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Day1.Value > Day1avg4.Value Then
Day1.FontWeight = 700
Day1.FontItalic = False
Else
Day1.FontWeight = 400
Day1.FontItalic = True
End If

End Sub

It seems to just look at the first and format all based up that first
calculation.
 
M

Marshall Barton

Juan said:
I didn't see an option for this in the report design view... I saw you
could set a specific number, but I'm comparing field1 to field2 for the
condition. Is this possible?

I tried the following in VBA

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Day1.Value > Day1avg4.Value Then
Day1.FontWeight = 700
Day1.FontItalic = False
Else
Day1.FontWeight = 400
Day1.FontItalic = True
End If

End Sub

It seems to just look at the first and format all based up that first
calculation.

That code should work as long as the Day1 and Day1Avg4
values are available in text boxes in the details section or
earlier in the report.

Conditional Formatting option for this is available on the
drop down list at the left. Select "Expression Is" and then
enter the expression:
[Day1] > [Day1avg4]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top