I have a table with "Date" and "Rate" fields. Not every record contains a value in the "Rate" field. is there a query that would insert the value from previous record in case the "Rate" field is null?
The sample table looks like this:

Date;Rate
20070101;100
20070102;
20070103;
20070104;200
20070105;205
20070106;206
20070107;
20070108;195

The result schould look like this:

Date;Rate
20070101;100
20070102;100
20070103;100
20070104;200
20070105;205
20070106;206
20070107;206
20070108;195

i use Microsoft Office Access 2003
Thank you

Share

Reply to This

Replies to This Discussion

You could use the DMAX function to figure out the rate for the previous date that's less than the current rate.

MaxRate: DMAX("Rate","MyTable","Date<$" & Date & "$")

^^ Those dollar signs "$" are supposed to be pound (number) signs - you know, SHIFT-3, but the editor isn't letting me type them in for some reason.

That will give you the rate from the last date, which you could then fill in to the NULL fields using an update query and an IIF statement.

Richard Rost
AccessLearningZone.com

Reply to This

RSS

Latest Activity

12 hours ago
22 hours ago
yesterday
bettonirm is now a member of Access Developers
yesterday
Well maybe this is a bit late (I have only just joined the site) but maybe somebody needs to do a bottom line analysis - that is how the company is being hit in the hip pocket. Just simply timing someone entering all of the information for each appl…
yesterday
on Tuesday
on Tuesday
on Tuesday

Badge

Loading…

© 2009   Created by Access Guy on Ning.   Create a Ning Network!

Badges  |  Report an Issue  |  Privacy  |  Terms of Service