• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

Conditional formatting Datasheet subform

I have set 3 criteria using the conditional formatting, however, that don't seem to be working correctly.

The field is a date field and I am checking to see if the field1 <= DateAdd("d", 45, Date) then change the background to red and font yellow.  the field data = 2/01/2008 and current date = 2/17/2009  why doesn't it display the conditional formatting?

Karen
0
Karen Schaefer
Asked:
Karen Schaefer
  • 2
  • 2
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
how about

<= DateAdd("d", 45, Date() )
parens                             ^^
0
 
Karen SchaeferAuthor Commented:
Thanks that seems to return the conditionally formatting, however, my calculation is not returning what I was hoping for.

I need to check and see if the date <= 30 days from current date, also note some of the dates can be quite old so I want to check the year and if the year is > than 1 year time span then format a different color, else than check if falls withing the 30 or 45 day criteria.

so what do I need to do to the fomula to check the time frame criteria?
0
 
Karen SchaeferAuthor Commented:
nevermind I figured it out by usin

between Date() and DateSerial(Year(Date()),Month(Date()),Day(Date()+45))
or
less than DateSerial(Year(Date()-1),Month(Date()),Day(Date()))
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
How about using DateDiff, for example:

DateDiff("d","1/01/2009",date())<=30
returns False

DateDiff("d","2/01/2009",date())<=30
returns True ...

mx
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now