Solved Conditional formatting not working with Calculated Date Field (1 Viewer)

Lochwood

Registered User.
Local time
Today, 14:09
Joined
Jun 7, 2017
Messages
130
MY query creates a calculated field based on 2 dates.. it takes the day and month from 1 field and the year from another to produce a renewal date. This works perfectly but i am trying to add conditional formatting to this field and it aint working.

I am thinking because it is a calculated field and not an actual formatted date field, that may be the issue. the query and the form show as medium date.

Sure there is a logical solution to this.

it is pretty random but future dates tend to be in red currently with the odd green one appearing.
 

Attachments

  • Screenshot 2021-01-19 155725.jpg
    Screenshot 2021-01-19 155725.jpg
    34 KB · Views: 319

theDBguy

I’m here to help
Staff member
Local time
Today, 14:09
Joined
Oct 29, 2018
Messages
21,453
Hi. That depends. Can you show us your calculation?
 

Lochwood

Registered User.
Local time
Today, 14:09
Joined
Jun 7, 2017
Messages
130
Hi. That depends. Can you show us your calculation?
Due_Date: IIf(Not IsNull([maxof1st_date]),Format(Day([MaxOf1st_Date]) & "/" & Month([MaxOf1st_Date]) & "/" & Year([MaxOf2ndDate])+1,"Medium Date"))
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:09
Joined
Sep 21, 2011
Messages
14,231
PMFJI,
Format returns a string?
I would use DateSerial() ?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:09
Joined
Oct 29, 2018
Messages
21,453
Due_Date: IIf(Not IsNull([maxof1st_date]),Format(Day([MaxOf1st_Date]) & "/" & Month([MaxOf1st_Date]) & "/" & Year([MaxOf2ndDate])+1,"Medium Date"))
Ah, there you go. As @Gasman said, you were using the wrong function, and that's why the CF was not working.

You could either change the function in the query or change the expression in the CF.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:09
Joined
May 21, 2018
Messages
8,525
Or due it the other direction
Expression:Cdate([yourfield]) > Date
...
 

Users who are viewing this thread

Top Bottom