Kaup, Chester
Chester_Kaup at kindermorgan.com
Wed Aug 24 16:30:30 CDT 2005
Thanks all!
-----Original Message-----
From: Heenan, Lambert [mailto:Lambert.Heenan at AIG.com]
Sent: Wednesday, August 24, 2005 3:50 PM
To: 'Access Developers discussion and problem solving'
Cc: Kaup, Chester
Subject: RE: [AccessD] Do While Loop Problem
When you hit EOF the expression myds.Fields(2) cannot be evaluated. You
need
two distinct tests...
Do While Not myds.EOF
If myds.Fields(2) < myds5.Fields(2)
'some lines of code
End If
myds.MoveNext
Loop
Now if access had 'short circuit' conditional testing you could have
written...
Do While Not myds.EOF And myds.Fields(2) < myds5.Fields(2)
...which would have exited the loop when the EOF condition failed, and
before the other test was done. But alas you can't. Access does checks
all
the conditions, even if the first one would terminate the loop.
Lambert
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester
Sent: Wednesday, August 24, 2005 4:36 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Do While Loop Problem
The following code generates a no current record error on the do while
line.
I thought it should exit the do loop when EOF = false was reached.
Thanks.
Do While myds.Fields(2) < myds5.Fields(2) Or myds.EOF = True
'some lines of code
myds.MoveNext
Loop
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