Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtotaling in Access VBA

Status
Not open for further replies.

game2008

MIS
Aug 22, 2008
3
US
I have a table called tblGDP. I want to have the ability to calculate the subtotals using VBA and post it to tblGDP. I can calculate the grand totals in TBLGDP no problem but the subtotals for each field, I don't have a clue. I need a way to calculate subtotal after each field by inserting a row after the last record for that field.

Currently:

ID FIELD GAS PRICE
1 BOYCOTT 23.00
2 BOYCOTT 100.00
3 FULLTON 50.00
4 RAYTON 70.00
Grand Total 243.00


I need:


ID FIELD GAS PRICE
1 BOYCOTT 23.00
2 BOYCOTT 100.00
Subtotal Boycott 123.00

3 FULLTON 50.00
Subtotal Fullton 50.00

4 RAYTON 70.00
Subtotal RAyton 70.00


ID is an autogenerated number


Thanks
 
Where did you visualize doing this? It is simple enough in a report, you can follow the wizards.
 
Your desired output is achievable via a report. Look into sorting and grouping - add "FIELD" as a group by and let it show a group footer. In that group footer show the result of a running sum of "FIELD
 
There are over 30 different fields and my ultimate goal is to export it into Excel. I thought about doing it in an Access report, but there are too many fields.
 
If you are outputting to Excel, why are you subtotaling in Access? Excel has quite a nice function for doing this.
 
Could you or someone tell me what the function is to subtotal in excel? Thanks
 
In the Excel menu: Data -> Subtotal ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top