Sum fields in sub form

  • Thread starter Thread starter Eric Blitzer
  • Start date Start date
E

Eric Blitzer

I would like to sum a field of the first 10 records in a
subform and then sum a field of the second ten records.

any help

Thanks

Eric
 
You could use a TopValues Query



Something like this:



SELECT DISTINCT TOP 10 Field1, Field2

FROM Table1
ORDER BY [YourSortingField];



Suppose you name the query Top10Query. Then you would create another
TopValues Query, just like the first one, but with the first 20 values
(Suppose you name it Top20Query).



Then you go to your form and had two controls:



one with the control source:

DSum("Field1";"Top10Query ";"")

(which sums the first ten records - Name it: Top10Control)



the other with the control source:



DSum("Field1";"Top20Query ";"") - [Top10Control].Value

(which sums the first 20 records and subtracts the first 10)



I hope this is what you want
 
Back
Top