Cumulative totals on a form

G

Guest

I have a continuous form that I want to calculate the cumulative total for
one of my controls. How would I set this up on my form to only calculate the
cumulative total for only those records shown on my form?
 
G

Guest

Try a Form header and/ or Form footer..in the textbox's Control Source, enter
=Sum(Thefieldof interest)

HTH - Bob
 
G

Guest

I thought of that but what I'm actually looking for is a cumulative total for
each record. For example if I'm showing 4 records I want to put a textbox
next to each record with a cumulative total.

Record 1 - 50
Record 2 - 50 - 100
Record 3 - 50 - 150
Record 4 - 50 - 200

I would need to put this in the detail section of the form, correct?
 
G

Guest

That will work using "Running Sum" In a Report...unsure in a Report.

Has anyone else done this?

TIA - Bob
 
G

Guest

I'm not familiar with "Running Sum". How will it know which record(s) it
needs to add?
 
J

John W. Vinson

I have a continuous form that I want to calculate the cumulative total for
one of my controls. How would I set this up on my form to only calculate the
cumulative total for only those records shown on my form?

Two ways:

1. Put a textbox on the Form Footer with a control source

=Sum([fieldname])

2. Use a Totals query with the same criteria as select the records viewed on
your form. Since you don't say how that's done, it's hard to advise how this
query would look.

John W. Vinson [MVP]
 
G

Guest

This is posted in the Newsgroup..

Hi Liz
The field that display the running sum, don't point it to anoter field in
the report, instead try and set the control source of that field to be the
same as the control source of the total field.
--
Good Luck
BS"D
 
J

John W. Vinson

That will work using "Running Sum" In a Report...unsure in a Report.

Has anyone else done this?

TIA - Bob

Running Sum applies only to reports, not to forms, unfortunately.

What you may need to do is to base the form on a Query (qryMyForm I'll call
it, use your own name) with a calculated field:

RunningSum: DSum("[fieldname]", "MyQuery", "RecordNumber <= " & RecordNumber)

This will sum the value of fieldname for all records less than or equal to the
current RecordNumber - and you must have a field that you can use in the place
of RecordNumber, and that field must be strictly ascending with no ties.

John W. Vinson [MVP]
 
G

Guest

Thanks John - Bob

John W. Vinson said:
That will work using "Running Sum" In a Report...unsure in a Report.

Has anyone else done this?

TIA - Bob

Running Sum applies only to reports, not to forms, unfortunately.

What you may need to do is to base the form on a Query (qryMyForm I'll call
it, use your own name) with a calculated field:

RunningSum: DSum("[fieldname]", "MyQuery", "RecordNumber <= " & RecordNumber)

This will sum the value of fieldname for all records less than or equal to the
current RecordNumber - and you must have a field that you can use in the place
of RecordNumber, and that field must be strictly ascending with no ties.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top