Gustav Brock
Gustav at cactus.dk
Sun Aug 10 10:54:32 CDT 2008
Hi Jim
Thanks.
I can add that I've searched all over for some comments to this. The only writing I ever found was this (in German):
http://www.vbarchiv.net/tipps/details.php?id=1308
which deals with a lot of stuff about datetime and specifically mentions this "feature" of TimeSerial.
/gustav
>>> accessd at shaw.ca 10-08-2008 17:43 >>>
Great tip Gustav.
Jim
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Sunday, August 10, 2008 5:06 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] TimeSerial buggy for negative date values
Hi all
I brushed this bug up and nothing has changed for Access 2007.
Also, I believe I can tell why TimeSerial has been designed this way. The
reason is that you with this behaviour can sum time values directly, because
it for negative inputs returns a symmetrical negative value from time zero
as this example demonstrates:
? TimeSerial(-18, 20, 0) + TimeSerial(18, -20, 0)
00:00:00
But don't attempt to use DateDiff on these values:
? DateDiff("n", TimeSerial(-18, 20, 0), TimeSerial(18, -20, 0))
1
If you need to use DateDiff - which normally is the recommended method by
Microsoft - use my TimeSerialFull or similar:
? DateDiff("n", TimeSerialFull(-18, 20, 0), TimeSerialFull(18, -20, 0))
2120
but, of course, don't attempt to add the values of TimeSerialFull directly:
? TimeSerialFull(-18, 20, 0) + TimeSerialFull(18, -20, 0)
12:40:00
To conclude, this is probably a bug by intention but the documentation
doesn't describe or explain this with a single word.
/gustav