[AccessD] I need a better way to do this - looping

Kaup, Chester Chester_Kaup at kindermorgan.com
Wed Jan 2 11:15:42 CST 2008


Guess I did not explain this well. The dataset is sorted by date
descending. I need to move down the dates finding the date of the first
record where the value in myds.fields(4) is less than 100.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Wednesday, January 02, 2008 11:09 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] I need a better way to do this - looping

Wouldn't it be easier to just "find" the first 100, as in 

rst.Find 100? 

That might not be the right syntax -- but should be close enough. 

Susan H. 


>I use the following code to loop through a record set until the field
> being checked is less than 100. This works great unless I run out of
> records before the condition is met. When that happens
> 
> Earliest date is equated to nothing (no current record). What might be
a
> better way to do this? Thanks.
> 
> 
> 
> Do Until Myds1.EOF
> 
>        Select Case Myds1.Fields(4)
> 
>            Case Is > 100
> 
>                Myds1.MoveNext
> 
>            Case Else
> 
>                Exit Do
> 
>        End Select
> 
>    Loop
> 
>    EarliestDate = Myds1.Fields(1)
> 
> 
> 
> Chester Kaup
> 
> Engineering Technician
> 
> Kinder Morgan CO2 Company, LLP
> 
> Office (432) 688-3797
> 
> FAX (432) 688-3799
> 
> 
> 
> 
> 
> No trees were killed in the sending of this message. However a large
> number of electrons were terribly inconvenienced.
> 
> 
> 
> -- 
> 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





More information about the AccessD mailing list