I am sorry, I guess I was not very clear on my requirements. I have a table that has 5 different fields:
Product ID, Area ID, Item ID, Sales%
I have 368 different combinations of Product ID & Area ID in my table.
Prodcut ID Area ID Item ID Sales %
1 1 1 30
1 1 2 30
1 1 3 20
1 1 4 20
For Each, Product ID/Area ID combination, I will like to do the following analysis:
I like to have a separate calculated column (called cum%sales) for each Product/Area Combination. I like to filter only those items for that are above the 80% cumulative sales% mark. In the above example, I would like to see only items 1,2 and 3 because they make top 80% of the sales for that Product/Area Combination.
I can do this analysis in VBA for one Product/Area combination but I don't how to do it for more than one becasue my main table has 368 Product Area Combinations. Each time we move on to a different Product/Area combination, the sumulative sum should reset to zero and we start calculating it again for the given Product/Area combination.
What I was thinking and I might be completely off on this that If we could create 368 different recordsets from the main table in VBA and then use each recordset to calculate the cum Sales%. But I have no clue how to do it is VBA. I just started programming in VBA Access. Thanks a lot for your reply. I hope you could help me on this.