|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
OK. Access 97.
RE: Running Total on a Form ---- I'm another newbie at this, so don't get frustrated. Table name: Sales Among other fields on my form, there are 3 fields that concern this scenario: 1. Profit (Sell minus Cost) That works fine. 2. Shipping_Profit (Shipping charge + Actual Shipping) That works fine. 3. Total_Profit (Profit plus Shipping_Profit) It gets its total from Profit + Shipping_Profit. That works fine. 4. Profit_To_Date (a running total of Total_Profit) It SHOULD update for each record, but I can't get it to do it! Now....I understand that Total_Profit is a calculated field. My problem is I don't yet understand how to build an expression for Profit_To_Date because it's based on a calculated field. I've been referred to the Microsoft site via URL's, but I need a simpler explanation. An simple example would be highly appreciated. Remember, I want this for a FORM and not a query or report. Sample Data: ID: ID Record 1: Cost: $100.00 Sold: $ 50.00 Profit: $ 50.00 Shipping Charged: $15.00 Shipping Actual: 12.00 Shipping Profit: 3.00 Total Profit: $53.00 Profit to Date: $53.00 <-- this amount should increase/decrease with each following record, based on Profit + Shipping Profit. I would like to have this on my form. I've been trying to figure this out for 4 days! Any sample expression would be appreciated. And please keep it simple. I'm new at this and already frustrated! Thanks to all. |
|
#2
|
|||
|
|||
|
Papa44,
In order to get a running total on your form, you will need to create a query that will sum the total profit to date for all records. Then make a subform from this query and place this subform onto your main form. You can resize this subform as necessary to give the cosmetic appearance that you want. You will need to requery the subform after new records are added, otherwise the subform will not update to your new profit totals until you close and reopen the main form. lwells |
|
#3
|
|||
|
|||
|
A Simpler way
Hi
Try using this code.It will enter a grand total for all records of the selected field into a unbound text box. dim curX as currency curX = DSum("[PurchasePrice]", "tblmain") Text86 = curX Just replace "PurchasePrice" with the fieldname u want the running total kept on and replace "tblmain" with the name of the table. Result will appear in Textbox of your choice. Just replace the Text86 with the name of the unbound text box where u want to display results. Hope this helps. Cheers and Merry Christmas. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Yet Another "Running Total" Question! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|