display subform field in main form as list

display subform field in main form as list

Hi,

 I need to display subform field in main form as list while adding subform records.

I have a field "Items" in main form and I have "item name" in subform. I would like to shows the list of "item name" in main form "items".

For example: The main form "Items" field will show "Item 1, Item 2, Item3" when i have selected Item 1, Item 2 and Item 3 in the subform "item name".

I have tried to do a loop and get the input in the list "getitemname" using the add function and display the list in teh main form:

getitemname = List();
for each r in subform
{
getitemname.add(row.item_name);
input.items = getitemname;
}

But the code above doesn't works as the items will be replaced by subsequent "item name" added.

Any help will be very much appreciated.

Thank you.