Originally Posted by
Ajax
running sums only apply to reports - and you have not said whether this is for a report or a form
you need to clarify a number of other things as well
1. based on your comments and example data, why can store 4 only have 1 B3 when 10 are allocated and they expect 6?
2. you are showing the outcome you require - you are not showing what your tables look like to start with. I would expect at least three tables, probably more
3. you also need to explain what basis you are using to define 'first row'. It would appear to be the alphabetical order of location name by product, but that does not make sense in the real world, the lower numbered locations will always take priority if that was the case.
4. your requirement seems to assume that you will be shipping to a maximum of 2 stores for any allowed quantity - again, seems an unlikely real world situation
5. does your final result need to be updateable? i.e. you want users to be able to modify or add to the data