Continuous Subform Totals

  • Thread starter Thread starter James G
  • Start date Start date
J

James G

Is there a way I can keep a running total in a continuous subform?

Like...

1st Record(Main Form)
(subform)=
Qty Total
2 2
3 5
1 6
5 11

2nd Record
Qty Total
3 3
3 6
4 10
2 12

James
 
Hi James

You could use the DSum fuctionality.

You need to include the ID of each record (make it Visible - No if you want)
Create a new text box in the details section of the record and use something
like this is the control source.

=DSum("[FieldName]","TableName","[ReordID] <= Forms![FormName]![RecordID]")

Note the FieldName is the field you are trying to "sum" or "add up"

Hope this helps
 
Hi,
This was close, but it didn't really work the way I needed it too. I
think this is going to be harder than I originally thought.

What I need is:
ID Hour Good Total
1 1 3 3 (total on same
line)
1 2 2 5
1 3 2 7

ID Hour Good Total
2 1 2 2
2 2 1 3
2 3 2 5

(ID and hour make up the primary keys in the subform)

Thanks
James

Wayne-I-M said:
Hi James

You could use the DSum fuctionality.

You need to include the ID of each record (make it Visible - No if you want)
Create a new text box in the details section of the record and use something
like this is the control source.

=DSum("[FieldName]","TableName","[ReordID] <= Forms![FormName]![RecordID]")

Note the FieldName is the field you are trying to "sum" or "add up"

Hope this helps

--
Wayne
Manchester, England.
Not an expert.
Enjoy whatever it is you do.



James G said:
Is there a way I can keep a running total in a continuous subform?

Like...

1st Record(Main Form)
(subform)=
Qty Total
2 2
3 5
1 6
5 11

2nd Record
Qty Total
3 3
3 6
4 10
2 12

James
 
Hi,
This was close, but it didn't really work the way I needed it too. I
think this is going to be harder than I originally thought.

What I need is:
ID Hour Good Total
1 1 3 3 (total on same
line)
1 2 2 5
1 3 2 7

ID Hour Good Total
2 1 2 2
2 2 1 3
2 3 2 5

(ID and hour make up the primary keys in the subform)

So include both:

Total: DSum("[Good]", "[tablename]", "[ID] = " & [ID] & " AND [Hour]
<= " & [Hour])

as a calculated field in the Query upon which the form is based.

John W. Vinson[MVP]
 
Back
Top