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

Hale, Jim Jim.Hale at FleetPride.com
Wed Jan 2 13:18:47 CST 2008


Couldn't you use a groupby query- something like
SELECT Count(tblWellData.[fldMeasure date]) AS [CountOffldMeasure date]
FROM tblWellData
WHERE (((tblWellData.fldWellNo)=1) AND ((tblWellData.fldMeasure)<100));

For well 1 this gives you the number of records where the measurement is
<100

HTH
Jim Hale

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

Let me try to explain what I am trying to calculate. Myds.Fields(4) is a
pressure variance measurement on an oilfield injection well. It should
always be below 100. The goal is to count the number of records (date
descending) from the most recent to the first one where Myds1.Fields(4)
is less than 100 for each well. The number of records per well varies.
If all the records for a well have Myds.fields(4) with a value above 100
the correct answer is the number of records for the well. If record 11
descending from the most recent is less than 100 then the correct answer
would be 10. Hope this makes sense. 


***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.




More information about the AccessD mailing list