Ken Ismert
KIsmert at TexasSystems.com
Wed Nov 19 17:02:38 CST 2003
Lambert, Gustav: Hmmm... What version of Access are you using? Lambert's routine gives correct results using Access 2000, SP3. I get 12/29/1899 for the subtractions > 2 hours, and 12/31 for additions > 23. -Ken -----Original Message----- From: Heenan, Lambert [mailto:Lambert.Heenan at AIG.com] Sent: Wednesday, November 19, 2003 4:43 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Pop-quiz: DateAdd() and negative time values Gustav, Interesting bug you've discovered there, but the moral is not "Be careful with negative time values", but rather look out for Dec 30 1899 and "negative additions" Here's a little code I just run and the output from it... . . . Notice that for the magic date 12/30/1899, no matter how many hours you subtract from a Date/Time item you still wind up with a date of 12/30/1899. On the other hand if you add hours on everything seems to work as expected. Lambert . . .