Ok i'm banging my head against a wall with this one.
I have a field on my form (Date to complete IA). What I want is if the date to complete IA is within 5 days of todays date, I want the field to turn orange. If the date has past, then I want it to turn red, provided that the IA Status meets certain criteria, and that the IA has not been submitted (date ia submitted).
The field turns red happily enough if the date has passed, but for example, if when testing I change the date to, say 40 days from now, the field stays orange and I cannot see why.
Ive added a msgbox to return the calculated value so I know what is being returned is correct, just the IF statement seems to ignore the value... Any ideas?
Here is the IF statement:
countdays = date_to_complete_ia - date
' if date has past, turn the field red
If countdays <= 0 And (Me.IA_Status = 4 Or Me.IA_Status = 5 Or Me.IA_Status = 7) And IsNull(Me.Date_IA_Submitted) Then
Me.Date_to_complete_IA.BackColor = 255
Else
' if date is within 5 days of now, turn it orange
If (countdays > 0 And countsdays < 6) And ((Me.IA_Status = 4 Or Me.IA_Status = 5 Or Me.IA_Status = 7) And IsNull(Me.Date_IA_Submitted)) Then
Me.Date_to_complete_IA.BackColor = 52479
Else
' leave the field white
Me.Date_to_complete_IA.BackColor = 16777215
End If
End If
I have a field on my form (Date to complete IA). What I want is if the date to complete IA is within 5 days of todays date, I want the field to turn orange. If the date has past, then I want it to turn red, provided that the IA Status meets certain criteria, and that the IA has not been submitted (date ia submitted).
The field turns red happily enough if the date has passed, but for example, if when testing I change the date to, say 40 days from now, the field stays orange and I cannot see why.
Ive added a msgbox to return the calculated value so I know what is being returned is correct, just the IF statement seems to ignore the value... Any ideas?
Here is the IF statement:
countdays = date_to_complete_ia - date
' if date has past, turn the field red
If countdays <= 0 And (Me.IA_Status = 4 Or Me.IA_Status = 5 Or Me.IA_Status = 7) And IsNull(Me.Date_IA_Submitted) Then
Me.Date_to_complete_IA.BackColor = 255
Else
' if date is within 5 days of now, turn it orange
If (countdays > 0 And countsdays < 6) And ((Me.IA_Status = 4 Or Me.IA_Status = 5 Or Me.IA_Status = 7) And IsNull(Me.Date_IA_Submitted)) Then
Me.Date_to_complete_IA.BackColor = 52479
Else
' leave the field white
Me.Date_to_complete_IA.BackColor = 16777215
End If
End If