VBA To Edit Font Color Based On Field Value & Age

sherlocked

Registered User.
Local time
, 21:18
Joined
Sep 22, 2014
Messages
125
Hello!

I am attempting to adjust the font color of a date field on a report based on the value of two other fields. I have the below code set in the "On Format" property of my detail section - however it does not work when I open the report to view.

Any thoughts on what I'm doing wrong? Your help is greatly appreciated! :D

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Frequency = "Annually" Then
If Me.ClassDate < (DateAdd("yyyy", -1, Date)) Then
Me.ClassDate.ForeColor = vbRed
Me.ClassDate.FontBold
End If
End If
End Sub
 
Update! I was able to use Conditional Formatting to achieve my aims. However if anyone knows of a way to do this using VBA I would love to have an answer for any future projects that may require more criteria than CF will accommodate.

Thanks! ;)
 

Users who are viewing this thread

Back
Top Bottom