Subform as pop-up box - getting the data back into the main form?

Subform as pop-up box - getting the data back into the main form?

Hi All, 
I've got a huge subform in my main form, so I've made it a pop-up form. 

The issue is, On Submit of the pop-up form, I need to push at least one of the field values back to the corresponding row of a subform within the main form.

Each row contains a decision box that, when ticked, will pop-up the record for them to edit if needed.

Passing a unique field to the pop-up subform:
The use case is for adding rooms to a home. The subform pops up On User Input of Room_Type field. If Room_Type is Bathroom, I want the unique field to be Bathroom 1, but if another row is added with Room_Type as Bathroom, I need the unique field to be Bathroom 2. So the main form needs to check if Bathroom 1 exists, and if so, name it Bathroom 2.
I've tried this:
  1. numvar = 1;
  2. roomvar = input.Subform.Room_Type + " ";
  3. for each r in Subform[Room_Type == "Bathroom"]
  4. {
  5. numvar = numvar + 1;
  6. roomname = roomvar + numvar;
  7. }
This works if I submit the main form and try again between each added record, but I want to submit the pop-up form, have it close and automatically fill in the corresponding row, ideally instantly, but could also be updated On Add Row of the subform (but how would I update the final row?) 

I also need to pass the ID so each row's record can be edited On User Input of the decision box.



Has anyone else used a similar method, who would be willing to share?

Thanks!
Levi