Results 1 to 13 of 13
  1. #1
    fedesc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    14

    a Question about conditions in access

    Hey you all!
    i'm not sure that's the right word. but let's say i have a record that i have put in it a time field.
    i need access to recognize if it passed more than one hour to turn red in the background.


    for example . i have a alarms db. and the time the alarm started if the alarm is still active after one hour i need it to turn red.
    so, what's the proper way to do that?!

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Are you talking about showing this in red on a Form or a Report . . .
    ?

  3. #3
    fedesc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    14
    Hey , i'm talking about a report .
    the report is query based that shows only active alarms.
    i want those alarms witch are active more than 1 hour to be red. tnx

  4. #4
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    You can use Conditional Formatting on that field and put an expression in saying something like:
    if the difference between 'Now' and the time in your Field is more than 59 minutes and 59 seconds - turn the back color red.

  5. #5
    fedesc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    14

    Question

    Yeah well that's the way i was thinking to! i just don't know what the right syntax for that.
    i have atime field as a date/time field and no idea further . . .

  6. #6
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    In your Time field - you ONLY have the Time - no Date?
    So - it would look like 3:17 PM - or 7:25 AM?

  7. #7
    fedesc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    14
    nope it's only a long time HH:NN:SS

  8. #8
    fedesc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    14
    Anyone? i couldn't solve it yet.

  9. #9
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Is there any chance that the Alarm will still be active the next day?
    What if the Alarm goes off at 11:55:00 PM.
    At 12:56:00 AM - one hour and one minute later - if you try & make the logic work by subtracting Start time [11:55:00 PM] from current time [12:56:00 AM] - you will get a negative number . . . and your report cell will not turn red.

  10. #10
    fedesc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    14
    yeah well it could stay for the next day as active
    even if it's one minute after the hour i need it to turn red until i dis activate the alarm manually and than it disappears from the sub report

  11. #11
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Sorry it took so long.

    Try this in your Conditional Formatting dialog Box:
    Choose 'Expression is', enter this as the Expression & then select your Background/Foreground Color.

    Code:
     
    DateDiff("h",[StartDate],Format(Now(),"hh:nn:ss"))>0
    [StartDate] is the field in which I have the Time [Eg: 08:25:15 AM] when the Alarm went off.

    Let me know if this helps!
    Last edited by Robeen; 09-30-2011 at 10:13 AM. Reason: Ommission.

  12. #12
    fedesc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    14
    Nope , it didn't do jack! :X change the [startdate] to [ atime]- witch is my time field , even tried to change the ">0" to ">1" both of them didn't affect the record in any way!! :\

  13. #13
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    This is working in my test DB.
    Could you post a copy of your database here so I can look at it?

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

Similar Threads

  1. Sum Column with conditions
    By g8rnc in forum Access
    Replies: 1
    Last Post: 06-10-2010, 09:59 AM
  2. if...then conditions ???
    By em07189 in forum Access
    Replies: 6
    Last Post: 03-05-2010, 10:29 PM
  3. Conditions / Expressions
    By Mark344 in forum Access
    Replies: 1
    Last Post: 02-19-2010, 08:15 AM
  4. Expression with multiple conditions
    By techexpressinc in forum Queries
    Replies: 3
    Last Post: 06-19-2009, 08:33 PM
  5. Iff Statement Meeting 2 Conditions
    By newbie in forum Access
    Replies: 11
    Last Post: 06-11-2009, 11:59 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