[AccessD] Loop Until Date=Date

Andy Lacey andy at minstersystems.co.uk
Wed Jan 23 01:51:02 CST 2008


Personally Mark I'd make the test >= rather than = in case some craziness in
the date maths causes them never to be equal.

-- Andy Lacey
http://www.minstersystems.co.uk 

>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com 
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
>Sent: 23 January 2008 01:21
>To: Access Developers discussion and problem solving
>Subject: Re: [AccessD] Loop Until Date=Date
>
>
>
>Susan,
>
>Inside the loop it adds 30 minutes..."RecordDT = 
>CDate(DateAdd("n", 30, RecordDT))"...so RecordDT...should and 
>does catch up to RecordDT_End...they look equal...but the code 
>does not see it that way.
>
>Thanks,
>
>mark
>
>
>> From: ssharkins at gmail.com
>> To: accessd at databaseadvisors.com
>> Date: Tue, 22 Jan 2008 19:35:25 -0500
>> Subject: Re: [AccessD] Loop Until Date=Date
>>
>> I'm sure to be missing something here, but you're defining 
>> RecordDT_end and RecordDT with two different time values, so 
>> regardless of what rst!Q_DT is, they can never match.
>>
>> Susan H.
>>
>>
>>
>> Hello All,
>>
>> I am looping thru a recordset...and I need it to stop when 
>it gets to 
>> a certain time. I am sure I am missing something 
>simple...below is the 
>> code...it FAILS!!!...and I have no clue why...probably very 
>> simple...but anyway...any thoughts...even the IF fails...when they 
>> appear to be equal????
>>
>>
>> Dim RecordDT As Date
>> Dim RecordDT_end As Date
>> RecordDT_end = CDate(rst!Q_DT & " 4:30:00 PM")
>> RecordDT = CDate(rst!Q_DT & " 9:30:00 AM")
>>
>> Do Until RecordDT = RecordDT_end
>> If RecordDT = RecordDT_end Then MsgBox "yes"
>> 'Inner Loop
>>
>>
>> RecordDT = CDate(DateAdd("n", 30, RecordDT))
>> Loop
>>
>>
>> Thanks,
>>
>> mark
>>
>> _________________________________________________________________
>> Helping your favorite cause is as easy as instant messaging. You IM, 
>> we give. 
>> http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com 
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com 
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>
>_________________________________________________________________
>Helping your favorite cause is as easy as instant messaging. 
>You IM, we give. 
>http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join
>-- 
>AccessD mailing list
>AccessD at databaseadvisors.com 
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com
>
>






More information about the AccessD mailing list