Detail - if this includes the footer
Put one in the "footer" part of the subform.
In your controls "data" section use it as you would on a report ie =Sum([TotalAmount]) (if TotalAmount is in the main part etc etc)
If not create a column in the table that will hold the running total and store the running total in it as you go.
As you add a newLine amount lookup the last totalAmount, add the newLine amount and store it in the new totalAmount.
AS long as a control is linked to a table you can put in, change it as you will.
OK Firstly a query is just a selection that comes from a table/s. The table is what you should be looking at.
Somehow you need to be able the place another column in the table (it needs to be updateable). This is the place that holds the running total. This will allow diferent totals in your form.
Now for the hard bit. (Of course there may be other way to do this)
Know how to code?
After Update (of the subform [qty] or whatever) Create a recordset also based on the same query.
Loop through the rec/set to find the runtotal so far and add it to your new total and save it in the running total column.
Hi, I've got the following saved for running sums in continuous forms:
SELECT Table1.asd, DSum("[asd]","table1","[AN]<=" & [AN]) AS RunningSum
FROM Table1;
Your table needs an incrementing number, like an autonumber field for this to work. Create a table - Table1. Create one field -ASD & make it Numeric.
Create another field - AN & Make it an autonumber.
Enter a few numbers into the ASD field.
Create a query in design view. Select: View - SQL View and paste the select statement above into it. The results should be what you're looking for.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.