Results 1 to 4 of 4
  1. #1
    Delta729 is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    Los Angeles
    Posts
    95

    Conditional Formatting on datetime field

    Okay, I'm sure this is pretty simple to do, but I've completely messed this up. I have a form that pulls in open project information that has a datetime field called "Duetime". What I'm attempting to do is that when this datetime field is less than 1 hour away, to turn the field background orange. Also, if less than 30 minutes to actually being past due, then it would be red.

    Can someone help me out or point me to easy to understand article for this. I'm messing this up and getting this turned around in my head.



    Thanks,
    Dan

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    You can't do it in a continuous form. ALL records get the same color.
    it can only be done in a single record form.

    If txtTime >[dueTime] then
    txtTime.backcolor = vbRed
    end if

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The criteria in Conditional Formatting would be like:

    [Duetime] < DateAdd("h", 1, Now())

    Would have to regularly refresh the form to get the calcs to update.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Delta729 is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    Los Angeles
    Posts
    95
    OMG, thanks June. That did it. I was previously attempting Now()-....
    This works perfectly.

    I have this for the red.
    [Duetime] < DateAdd("n",30,Now())

    followed by this for the orange.
    [Duetime] < DateAdd("n",60,Now())

    Thank you so much again.

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

Similar Threads

  1. Replies: 6
    Last Post: 02-12-2014, 05:16 PM
  2. Conditional Formatting based on another field - Part II
    By Harley Guy in forum Programming
    Replies: 8
    Last Post: 10-17-2013, 12:46 PM
  3. Replies: 5
    Last Post: 10-15-2013, 07:49 AM
  4. Replies: 1
    Last Post: 04-26-2012, 08:31 PM
  5. Replies: 18
    Last Post: 09-30-2011, 06:41 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