-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Well I should have read the original query w/ more attention. Instead
of DMAX() it should be using the DSUM(), and, the Period comparison
should be less than or equal to (<=), and, the Abs() function isn't
needed [presumably, the odometer reading will always be a positive
number]. Try this:
SELECT VehicleID, [Period], Odometer, DSum("[Odometer]", "YourTable",
"[Period] <= " & [Period] & " AND VehicleID=" & [VehicleID]) AS Annual
FROM YourTable
ORDER BY VehicleID, [Period] DESC
This assumes Period and VehicleID are both numeric data types.
This query will sum the Odometer for the current period & all previous
periods for each VehicleID in the table. This is what's know as a
running-sum query. Here is a MS KB article that explains:
http://support.microsoft.com/support.../q138/9/11.asp
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQQ6Hq4echKqOuFEgEQJocACguD4+dOEqy7o5x/Ix1ejNzCebeF4An30p
j9MlhvEn61V0NTl35VAmrQxX
=oYjk
-----END PGP SIGNATURE-----
John Young wrote:
[color=blue]
> MGFoster
> ... thanks for your reply but am unable to get that ammendment to work
> either..... it gived me a zero ( 0 ) in the calculated field.... have
> looked at the Dmax() Method and can not get it to work as suggested
> ....[/color]