Full Version: Contitional Formats
UtterAccess Forums > Microsoft® Access > Access Forms
TreyReynolds
Good afternoon,
I am trying to add a conditional format to a timestamp field. I want the field to be red if the time that is in the field is less then three hours from that time. I also want to add a second format that makes it green is the format is equal or greater than 3 hours. Any Ideas?
Ofound the conditional format options for that box I just dont know how to put that code in there...
Thanks
Trey confused.gif
theDBguy
Hi Trey,
Welcome to Utter Access!
How about something like:
Expression Is: DateDiff("n", Now(), [TimeStampField])<180
(untested)
Hope that helps...
TreyReynolds
Hey I am trying this and it just formats the whole box and does not change after the three hour mark. I test three years and still nothing.....
theDBguy
Well, maybe because I only gave you half of the answer.
id you also place something to turn it off? Such as:
Expression Is: DateDiff("n", [TimeStampField], Now())>=180
Hope that helps...
TreyReynolds
So I figured out why that was not working. Apparently, 1 = 1 day. when I input your formula, it was looking at 180 days. So what I did to fix this was going to "Format" then "Conditional Format" I said that the value had to be between "Now()" and "Now()-0.125"
= 1day
1/24 =0.041667
*3 = .125
Thank you for putting me on the right track!!
theDBguy
You're welcome. Glad to hear you got it figured out.
Just as a note, my formula was looking for 180 minutes, not 180 days. The "n" parameter in a DateDiff() function stands for minutes.
Good luck with your project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.