Create # of records to match number in a field, i.e if Qty = 3 create 3 records

Create # of records to match number in a field, i.e if Qty = 3 create 3 records

I'm writing some code which creates records in a custom module from a subform.

Currently the code creates 1 record per entry in the subform. What I want to do is take the quantity from the line in the subform and create that number of records.

I.E

If the qty on the subform entry is 3, I need 3 records
If the qty on the subform entry is 10, I need 10 records.