Results 1 to 8 of 8
  1. #1
    THarrison is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2015
    Posts
    16

    Row conditional formatting based on a specific date range


    Good morning,

    I am new to Access and I'm having trouble getting my rows of an Access 2007 report to conditionally format how I want them to. Here's the situation:

    I have a report that has about 12 columns of data, one of them being a next deadline field, titled "NEXT DEADLINE".

    I have already formatted the specific "NEXT DEADLINE" field to highlight red if the deadline is within 30 days from a certain date, which works fine. However, when I try to conditionally format the other columns, such as "CUSTOMER NAME" in the report to highlight red based on the date in the NEXT DEADLINE field being within a certain range, such as within 30 days, nothing happens.

    I have looked online and found suggestions of expressions to try such as [NEXT DEADLINE]<30, Eval([NEXT DEADLINE] Between "3/25/2015" And "4/25/2015"), and other combinations of these conditions, and none of them seem to work.

    Does anyone have any advice or possible solutions? Any advice is greatly appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    [NEXT DEADLINE]<Date()+30
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    THarrison is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2015
    Posts
    16
    Pbaldy, I assume I am supposed to add in the date that I want to add 30 days to (i.e. [NEXT DEADLINE]<Date(3/25/2015)+30), correct? If so, Access returned the error "The expression you entered has a function containing the wrong number of arguments".

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    THarrison,
    Date() is an Access intrinsic function. It represents today's Date.

    Paul's suggestion
    [NEXT DEADLINE]<Date()+30
    is code for [NEXT DEADLINE] is less than 30 days from today Date()
    Date()+30 is today + 30 days

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    And the function is a function with no arguments, so nothing goes inside the parentheses, it's just Date(). There's also Time() for the current time and Now() which returns the current date and time together.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    THarrison is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2015
    Posts
    16
    Thank you for the clarification, Orange and Paul. I tried the expression [NEXT DEADLINE]<Date()+30, however, it is not returning the format that I set if the value is true, even if the deadline is within 30 days. Any other ideas? Do I need to format the [NEXT DEADLINE] field a certain way in order for the conditional formatting to work in the other fields? Currently, it is formatted as m/dd/yyyy.

  7. #7
    THarrison is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2015
    Posts
    16
    Please disregard my last message. I had the background set to "Transparent". When I changed that to "Normal", the formatting took effect. Thank you both for your help!!!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Conditional Formatting For a Specific Date
    By RangerE51 in forum Access
    Replies: 2
    Last Post: 02-13-2015, 12:22 AM
  2. Conditional Formatting Based On Another Column
    By Rustin788 in forum Reports
    Replies: 3
    Last Post: 08-13-2014, 01:52 PM
  3. Replies: 16
    Last Post: 12-02-2013, 06:20 AM
  4. Conditional Formatting based on another field - Part II
    By Harley Guy in forum Programming
    Replies: 8
    Last Post: 10-17-2013, 12:46 PM
  5. Replies: 11
    Last Post: 12-21-2011, 09:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums