[AccessD] FW: Find a record in table with intervals

Susan Harkins ssharkins at bellsouth.net
Mon Jul 25 09:55:00 CDT 2005


A subquery using IN? It sounds to me like the real work is in the
conditional expressions. 

Susan H. 

I have table (table1) with dates and a value associated with the date.

For example

 

1/1/2001                  20

7/13/2003                27

12/26/2003              31

6/4/2004                  33

1/13/2005                40

6/7/2005                  44

 

I have another table (table 2) with values in it also. Using the date in
this table I need to find the value in table one that would be correct for
that date. It is assumed the value in table one carries forward until the
date changes. The value associated with the last date carries forward
forever.

 

For example a date of 10/13/2004 should return a value of 33. I was able to
achieve the desired result with several if then else and do loops but was
hoping for a better solution. Was hoping for something like the vlookup
function in Excel.

 

Thanks.

 

Chester Kaup

Engineering Technician

Kinder Morgan CO2 Company, LLP

Office (432) 688-3797

 

No trees were killed in the sending of this message. However a large number
of electrons were terribly inconvenienced.

FAX (432) 688-3799

 

--
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