By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

how to get the progressive total in a form

P: 17
I have designed a form in ms access to show the account of firms. In the total column i need a progressive total of one or more column of this form. what to do please



thanks in advance
Mar 15 '07 #1
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,347
You can do this using a running sum in a report. If it absolutely has to be in the form, let us know.
Mar 15 '07 #2

dima69
Expert 100+
P: 181
There is no "elegant" way to do so, I am afraid. The way I solve it is like this:
1. Create a dynamic array A() (global to the form)
2. Calculate the running total and store at the array, so that the array index coincides with the record number on the form.
3. Create a function
Expand|Select|Wrap|Line Numbers
  1. Function theTotal() As Currency
  2. Dim rs As Recordset
  3. Set rs = Me.Recordset.Clone
  4. rs.Bookmark = Me.Bookmark
  5. theTotal = A(rs.AbsolutePosition)
  6. End Function
4. At the field to diplay the totals, set ControlSource to
Expand|Select|Wrap|Line Numbers
  1. =theTotal()
Of couse, you shoud provide the additional mechanizm to recalculate the totals whenever nesessary.
Mar 15 '07 #3

P: 6
Is your form a SINGLE VIEW TYPE OR CONTINUOUS TYPE? If it is SINGLE VIEW TYPE, then you can do the following without having to use any programming.

ON the footer of your form, create an unbound textbox.
Name it whatever you want.
Control Source should be as follows

=DSUM("[nameofthefieldtosum]","nameofyourtable/queryonwhichthisformisbuilt","[pkeyfield]<=forms![pkeyfield]").

Give it a shot and let me know if it helped you. Good luck
Mike
There is no "elegant" way to do so, I am afraid. The way I solve it is like this:
1. Create a dynamic array A() (global to the form)
2. Calculate the running total and store at the array, so that the array index coincides with the record number on the form.
3. Create a function
Expand|Select|Wrap|Line Numbers
  1. Function theTotal() As Currency
  2. Dim rs As Recordset
  3. Set rs = Me.Recordset.Clone
  4. rs.Bookmark = Me.Bookmark
  5. theTotal = A(rs.AbsolutePosition)
  6. End Function
4. At the field to diplay the totals, set ControlSource to
Expand|Select|Wrap|Line Numbers
  1. =theTotal()
Of couse, you shoud provide the additional mechanizm to recalculate the totals whenever nesessary.
Mar 15 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.