check info before Syncing two Subforms

check info before Syncing two Subforms

Hi

i have a secondary form that dumps its info into a master report. The secondary form has a subform and there is a corresponding subform in the main report

CASE: 
Main form alreayd has ONE SAMPLE_ID listed on it
User submits on secondary form adding a new row, and a new SAMPLE_ID

GOAL: 
When submitting, the code should look at the main form, see all the SAMPLE_IDs already listed on each row in the subform, and then add the new SAMPLE_IDs from the secondary form that are missing

so far, here is my code:
  1. for each row in FetchID.Linked_Samples
  2. {
  3. SampleIDCollect.insert(row.Sample_IDs);
  4. }
  5. for each row in Linked_Samples2
  6. {
  7. if(!SampleIDCollect.ContainsValue(row.Sample_IDs2))
  8. {
  9. NewRow = Product_Form.Linked_Samples();
  10. NewRow.Sample_IDs=row.Sample_IDs2;
  11. NewRow.Factory=row.Factory2;
  12. NewRow.Status=row.Status2;
  13. FetchID.Linked_Samples.insert(NewRow);
  14. }
  15. }
  16.  
The error i am getting is: 
"Error at line number: 8
Variable SampleIDs2 does not exisit in ZC_SUBFORM_17"

SampleIDs2 exists in the SECONDARY form's subform. this error is telling me that it doe NOT exist in the MAIN form

i think deluge is getting stuck thinking that the "row" in line 8 still applies to the main form's subform (FetchID.Linked_Samples) , when really ive already closed that bracket and opened a new "for each row" which applies to Linked_Samples2 (the secondary form's subform)

I think this may be a deluge bug, but any other advice?