Results 1 to 4 of 4
  1. #1
    drewdrew is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    4

    Unhappy Conditional Formatting with dates

    Hi all,

    I have trawled the sites to try and find an answer to a simple question with conditional formatting:



    I am using Access 2013 with some dates populated in a ubound box. I would like conditional formatting applied to this box with the following thresholds:

    Turn Red if the value is within 30 days of the ubound date
    Turn Orange if the value is within 31 days and 60 days of the ubound date
    Turn Green if the value is over 61 days of the ubound date

    I have tried variants with trial and error and I cannot get a finalized result.

    All help if appreciated.

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Code:
    Turn Red if the value is within 30 days of the ubound date
    What do you mean "the value"?

    You need two date controls. One is the unbound text box, what is the other date control??

    Lets say you have a form bound to a table.
    The table has a date field "NextReading".
    The form is set to continuous forms view.
    In the header is the unbound text box named "Text47".

    In the details section is a text box control bound to the field "NextReading". The control is named "tbNextReading". (tb for text box)

    To set up conditional formatting, you would click on the "tbNextReading" and open the conditional formatting dialog box.
    Add a new rule
    Field value BETWEEN [Text47]+31 and [Text47]+60
    Then click on the bucket (background color) and select Orange.
    Click on OK
    Click on New Rule
    Field value LESS THAN [Text47]+30
    click on the bucket (background color) and select Red.
    Click on OK
    Click on New Rule
    Field value GREATER THAN [Text47]+61
    click on the bucket (background color) and select Green.
    Click on OK
    Click on OK

    NOTE: the name of the text box in the form header MUST be enclosed in brackets, as in: [Text1]
    NOTE 2: the format for the unbound text box in the header must be "Short Date". (Open the properties, click on the FORMAT tab\ FORMAT property)

    Enter a date into the unbound text box Text47 in the header .
    Change the date to see if the BG colors change.

  3. #3
    drewdrew is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    4
    Thanks for the reply. When I mentioned value, I was referring to the date value that gets pulled into the ubound box [qual_rsd_latest] from a table.

    Click image for larger version. 

Name:	Picture1.png 
Views:	34 
Size:	209.8 KB 
ID:	23274

    I have taken the above advice and implemented it... but all dates that are in the ubound box [qual_rsd_latest] display with an orange background... dates from 3 years ago or even2 days ago display orange.

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    you have not followed ssanfu's instructions

    what you have added is the equivalent to 'if today is between today plus 31 days and today plus 50 days'

    today can never be anything other than today - so can never be greater than today

    you get the orange because 'today is less than today plus 30 days' is true

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

Similar Threads

  1. Replies: 2
    Last Post: 11-12-2015, 10:46 AM
  2. Conditional Formatting of dates by fiscal year?
    By Michael.Reynolds1775 in forum Access
    Replies: 3
    Last Post: 03-31-2015, 01:44 PM
  3. Replies: 6
    Last Post: 05-26-2013, 09:10 PM
  4. Conditional Formatting on Dates
    By jpicard in forum Access
    Replies: 12
    Last Post: 11-02-2011, 03:36 PM
  5. Using Conditional Formatting & Dates
    By djclntn in forum Forms
    Replies: 14
    Last Post: 04-12-2011, 07:04 PM

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