Here ya go, George...
I suggest you play with my database to see if it really does what you want before you try to use it in the production DB.
Note that I modified qryPurchaseOrders to allow input of part number and job number to the process as parameters and to ensure the POs are accessed in ascending order by date.
To run the procedure, first make sure that you have a reference to 'Microsoft ActiveX Data Objects' which is needed to open queries and tables using ADO. To check this, use Alt-F11 to get to the Visual Basic window, then 'Tools'/'References' will show you the list. If there is no check by 'Microsoft ActiveX Data Objects' , find it and check it and click 'OK'. Use the latest version (2.8 in my case).
Then, In the Immediate window of Visual Basic, type 'call GetParts(
,,)' and press enter. For my database, part number = 2011300 and job number = 106024. I used these quantities for sucessive runs in order: 5,10,10,30. After each run, check the contents of tblAllocated to see if the records are as you expected. You can look at the records generated by my tests before you start. You will have to delete the contents of tblAllocated in order to have some parts available because I used them all.
Further testing with more PO data is advisable.
Dan