Sounds like a .Net application, but I can’t be sure. When you create a new subform. It will re-initialize all records and variables unless you use a global variable on your main form to tell it to go to that particular record. It would be more helpful if you gave us the language your programming in.
Sorry, this is an Access application.