[AccessD] Loop Until Date=Date

Drew Wutka DWUTKA at Marlow.com
Wed Jan 23 11:15:37 CST 2008


1/48=.0208333333333..........

So every time you add 30 minutes, you're tacking on all those 3's, and with floating point math, you start to get some tiny tiny decimals creeping in on you.

One way to change this is to no use date add.  Instead, build and change your data/time structure with DateSerial and TimeSerial.

Though the simpler method would be to change the comparison from = to >=

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
Sent: Wednesday, January 23, 2008 11:00 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Loop Until Date=Date


Ok...its now clear as mud...

RecordDT = 12/17/2007 4:30:00 PM
RecordDT_end =12/17/2007 4:30:00 PM
CDbl(RecordDT)=39433.6875
CDbl(RecordDT_End)=39433.6875
CDbl(RecordDT-RecordDT_End)=3.63797880709171E-11

I'm not liking computers very much right now...so...since I added 30 minutes I have this problem?

...and Going forward...I should never ask if 2 DateTime values are equal...I should compare using datediff and seconds?

Thanks,

Mark A. Matte


> Date: Wed, 23 Jan 2008 17:35:38 +0100
> From: Gustav at cactus.dk
> To: accessd at databaseadvisors.com
> Subject: Re: [AccessD] Loop Until Date=Date
>
> Hi Mark
>
> But what about: CDbl(RecordDT - RecordDT_end)?
>
> /gustav
>
>>>> markamatte at hotmail.com 23-01-2008 17:31:30>>>
>
> That was the first thing I did...both are showing 12/17/2007 4:30:00 PM...but the "=" fails.
>
> Thanks,
>
> Mark A. Matte
>
>
>> Date: Wed, 23 Jan 2008 11:22:05 -0500
>> From: fuller.artful at gmail.com
>> To: accessd at databaseadvisors.com
>> Subject: Re: [AccessD] Loop Until Date=Date
>>
>> I would add a Debug.Print statement at the top or bottom of the loop to
>> print out both values in Long Date format so you can see all the particulars
>> of both values. That should reveal the difference, and why equality is
>> failing.
>>
>> A.
>>
>> On 1/23/08, Mark A Matte wrote:
>>>
>>>
>>> Hello All,
>>>
>>> Thanks for the suggestions. I found last night that "DateDiff("s",
>>> RecordDT, RecordDT_end) = 0" would work...but I just can't seem to
>>> understand why they were not equal. I tried the suggestion below...but it
>>> failed as well. I also tried "If RecordDT>= RecordDT_end"...this
>>> works...but scares me because I don't know why it works and "=" does not. I
>>> think I will just use the datediff approach...but am still curious...
>>>
>>>
>>> Thanks,
>>>
>>> Mark A. Matte
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI BusinessSensitve material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list