Main form and subform have linked data? Should not need code to pass the ID from Form1 to its subform. If Master/Child Link properties are set, the ID should pass automatically as soon as any other data is input. This is the reason for form/subform structure - to facilitate records association.
But my subform is not showing in the Main form.