Question : Color Control on a form in Access 2003

I have the following code in a form and it turns the date red whether or not it is over due.  Could someone tell me why?  What can I do to fix it?  I have it for when the form opens and for if the Assignment Date field updates

Private Sub Form_Load()
If Date_Due >= Now() Then
        Date_Due.ForeColor = vbRed
    Else
        Date_Due.ForeColor = vbBlack
    End If
End Sub

Private Sub Date_Due_Change()
If Date_Due >= Now() Then
        Date_Due.ForeColor = vbRed
    Else
        Date_Due.ForeColor = vbBlack
    End If
End Sub

Answer : Color Control on a form in Access 2003

Using Conditional Formatting as suggested in my first post and also by DatabaseMX ...

1.) Open your form in Design Mode.
2.) Select your Date_Due control.
3.) From the Menu Bar click Format --> Conditional Formatting
4.) Set the Default Formatting Font Color to Black and ensure it is Enabled by clicking the icon to the far right in the box.
4.) Set Condition 1 to  ...
Field Value is    Greater Than or Equal To     Now()
Change the font color to red and ensure it is Enabled by clicking the icon to the far right in the box.

ET

Random Solutions  
 
programming4us programming4us