You need to step through your code and watch what it is doing rather than wasting your time taking stabs at a problem. The cause is obvious when you do that. The reason, not so much to me since I don't really know what is supposed to happen. Something calls this function: Function QuantityAllocated and it runs 5x so it seems to create 5 records. I just haven't got far enough into it yet to know what calls it.
EDIT - seems very odd that upon form closing you delete table records, populate table with 1's and 0's then delete that, then run query (which appends no records).
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.