Gareth:
A similar question cropped up some years ago in a magazine column to which I
occasionally contribute. I found I still have the query I came up with at
the time. Its based on a table Readings with columns ReadingDate , Reading
and ReadingType (e.g. Gas, Electricity etc):
SELECT R1.ReadingType, R1.ReadingDate, R1.ReadingDate -
(SELECT MAX(R2.ReadingDate)
FROM Readings As R2
WHERE R2.ReadingDate < R1.ReadingDate
AND ReadingType = R1.ReadingType)
AS DaysSinceLastReading, R1.Reading -
(SELECT MAX(R3.Reading)
FROM Readings As R3
WHERE R3.ReadingDate < R1.ReadingDate
AND ReadingType = R1.ReadingType)
AS Usage
FROM Readings AS R1
WHERE R1.ReadingDate >
(SELECT MIN(R4.ReadingDate)
FROM Readings As R4
WHERE ReadingType = R1.ReadingType)
ORDER BY R1.ReadingType, R1.ReadingDate;
The data can be entered in a form based on the Readings table and the usage
shown in a form, in continuous form or datasheet view, based on the above
query. If you have readings from more than one meter then you'd simply need
to add a Meter column to the table and correlate each of the subqueries on
the meter column as well as the ReadingType column.
Ken Sheridan
Stafford, England