In article <pOCdnb3ijf5YalfRnZ2dnUVZ_jidnZ2d (AT) earthlink (DOT) com>, "Guy"
<guy (AT) guym (DOT) com> wrote:
Quote:
I have two fields, one a to-do date and another the current date... both are
timestamp fields.
If the date/time is past, I need to alert, otherwise do something else.
If the date is the same, regardless of the time (before or after), I get a
"past"...
eg. 10/29/2010 6:00 PM shows "past" even at 10/29/2010 6:00 AM.
If I structure two scratch fields, (both number), then the tests work as
expected.
WIN XP 10.0 Adv
Help is appreciated. |
How is the data put into the two Fields?? How are you comparing the two??
My guess is that you are hitting this problem because of seconds and
fractions of seconds which are stored within Timestamp Fields.
Although the Fields may display as just "10/29/2010 6:00 PM" (depending on
formatting options), they can actually store something like "10/29/2010
6:00:17.4553 PM". Obviously this of course means getting an exact match is
near impossible since "10/29/2010 6:00:00.0000 PM" is in the past of
"10/29/2010 6:00:00.0001 PM"
The best option would be to take the difference between the two Timestamp
Fields and compare that against whatever is the definition of "past". For
example, if you are saying something more than 10 minutes (measured in
seconds) old is "past", then your comparison test would be:
If (CurrentDate - ToDoDate > 10 * 60)
{Perform "Past" functions}
Else
{Perform "NOT Past" functions}
End If
Helpful Harry

)