Link to home
Start Free TrialLog in
Avatar of Sandra Smith
Sandra SmithFlag for United States of America

asked on

Change lable and text control based on value

I have a user request that if the due date is less than Today plus 7 days, they want the lable and text control to appear on the report as red.  I tried the below in the group format, but it turns all lables and due date text controls to red.  This is an Access 2003 report.
Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)
'If Due date is with 7 or less days, make the box and data red

If Me.TaskDueDate <= (Date + 7) Then
     Me.lblTaskDueDate.BorderColor = RGB(239, 5, 29)
     Me.lblTaskDueDate.ForeColor = RGB(239, 5, 29)
     Me.lblTaskDueDate.FontBold = True
     
     Me.TaskDueDate.BorderColor = RGB(239, 5, 29)
     Me.TaskDueDate.ForeColor = RGB(239, 5, 29)
     Me.TaskDueDate.FontBold = True

End If


End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not sure if you can conditionally format a label.  If you cant, you can always use a borderless texbox instead of a label on your report and get the same effect.
Avatar of Sandra Smith

ASKER

Actually, I just asked that very question as I have two conditions that need to be met.