Associating Subform Records with Main Form Record?

Associating Subform Records with Main Form Record?

I am creating an application to schedule a person to go to different stores and perform inventory of items on the store shelf.

I have created a Main Form and SubForm.  
The Main Form is for the Inventory Scheduled event.
The Sub Form is the items that are to be inventoried at that Scheduled event.

Thus when a new Main Form Record is created (Scheduled Event) I want to run a script which automatically add records to the SubForm and auto fill the fields (Items to be inventoried).

I have written the script below.  This script is run on Form Action -> On Add -> On Success.
It successfully creates the records I want in the SubForm but the records are not associated with the main form.  IE when I view the MainForm, the records in the SubForm are not shown.

recProductCarriedInStore = ProductsCarriedByStore[store == input.store] ; 
for each rowProductCarriedInStore in recProductCarriedInStore 
{
   
insert into Inventory_Check_Record
[
 Added_User = zoho.loginuser
 Count_field = 0
 product_line = recProductCarriedInStore.product_line
 Product_SKU = recProductCarriedInStore.Product_SKU
 SKU_On_Shelf = "Unknown"




]

}

How do I associate the Subform Records with the Main Form Record?