Font changes color depending on date

Real Wally

Registered User.
Local time
Today, 15:28
Joined
Jan 28, 2003
Messages
107
Dear members,

I don't know if I'm asking a very hard question or not. I certainly am unable to find the answer myself so if you know how to solve the quetion below please let me know.

I have a form and report with dates for deadlines in it.
I'd like to use 'warning colors' with those date:

Deadline is more than 8 weeks ahead, font is black
Deadline is 4-8 weeks ahead: font is orange
Dealine is 0-4 weeks ahead: font is red.
Deadline met: font is green.

Is that possible? And if yes, How?

Thanks, looking forward to your solutions.

Walter
 
By using the IIf statement in code you should be able to do what you are looking for.

Code:
txtYourTextBox.ForeColor = IIf(txtDeadline > Date + 56, 0, IIf(txtDeadline > Date + 28 And txtDeadline < Date + 56, 26367, IIf(txtDeadline > Date And txtDeadline < Date + 28, 255, 65280)))

try playing about with that
 
Thanks for your quick reply Mile-O-Phile,

Mile-O-Phile said:
By using the IIf statement in code you should be able to do what you are looking for.


Unfortunately I don't know where to put that code! I've tried to paste it into the properties of the Deadline field (by clicking on the ... of the fore color) but that doesn't work. Excuse my ignorance but I need another pointer before I can proceed.

Thanks,

Walter
 

Users who are viewing this thread

Back
Top Bottom