Subject Inserting/Updating new records with data from previous records
Author Alan J Davies
Hi all, I hope you can help me with this.
I have a customer who scans barcodes to produce delivery notes. There
may be several barcodes per part to produce one line on the delivery
note. The quantities can vary - if there is insufficient raw material or
their customer needs them immediately.
e.g. scan barcode label at goods out department (there's a lot more data
but this is simplified)

Partno, del_qty no_boxes, (pallet_qty, qty_per_box - do not vary for
each part)
ABC 200 10 300 20
ABC 200 10 300 20
ABC 100 5 300 20

delivery note
Partno, del_qty no_boxes
ABC 500 25

So far so good, but some of their customers require a second barcode
label attached to the outer pallet (the 300 above)

I need to produce 2 pallet labels as follows:
Partno, del_qty no_boxes
ABC 300 15
ABC 200 10
I can easily generate a second identical label like this:
Partno, del_qty no_boxes
ABC 500 25
ABC 500 25

but I need to be able to deduct the second label qty of 200 from the
total of 500 and the no_boxes of 10 from the total of 25. And of course
there may be more than 2 labels needed.... so I'd need 300+15, 300+15,
300+15, 200+10 for 4 labels for a total of 1100 parts.
I've tried to do this with an SP but can't work it out so any advice
would be welcome.

Alan J Davies