How to pouplate sub-form records from another sub-form

How to pouplate sub-form records from another sub-form

Hi,

I am facing a following problem, please help.

I want to populate the data in a sub-form from a data in another sub-form based on a condition in the main form. There is only one main form record and several sub-form records.  If anyone has a source code or script to do that, please share it with me.

I tried out several alternatives but it only loads the first record and beyond that it does not work. I am facing a challenge to get the IDs of sub-form records as I get the main ID but not the sub-form.

Kindly help.

Thanks,

Milind