Since you are adding the line item with button code, I don't know what code you are using to add the additional records, but I suspect you may be opening the subform in StandAlone Mode. Even in StandAlone mode, the OnFormEntry code should trigger, but, in that case, there may notl be a correct ParentForm associated with the line item. As a true subform, each PO Line Item record should be a single form, but your design may not look like that.
Triggering the code OnElementChange for the line item will probably be OK. There is no "right way" to trigger any code, it will all depend on the specific design and what you want to do. In my opinion, most unique "record" elements should probably be triggered on form events, and most other element values would probably trigger on other element events.
I usually prevent subforms from opening in StandAlone mode for data entry, only allow them to open in StandAlone for entering Retrieve specs and read only browsing. Here is some sample code from the same form subform I used earlier:
//StandAlone Form Conditions
If @FormIsStandalone() = 1 Then {
// Prohibit Saving and Deleting
NotifyForm(1)
NotifyForm(4)
@MsgBox("This data can only be added/modified using the Clients Form","","")
// Show Audit Tracking elements
Visibility(ClientNumber,1)
Visibility(AddedBy,1)
Visibility(DateAdded,1)
Visibility(TimeAdded,1)
Visibility(ChangedBy,1)
Visibility(DateChanged,1)
Visibility(TimeChanged,1)
Visibility(Record,1)
Visibility(RecordSource,1)
ReadOnly(ClientNumber,1)
ReadOnly(TaxYear,1)
}
If @FormIsStandalone() = 0 Then {
// Enable Save/Delete
NotifyForm(0)
// Hide Audit Tracking elements
Visibility(ClientNumber,0)
Visibility(AddedBy,0)
Visibility(DateAdded,0)
Visibility(TimeAdded,0)
Visibility(ChangedBy,0)
Visibility(DateChanged,0)
Visibility(TimeChanged,0)
Visibility(Record,0)
Visibility(RecordSource,0)
ReadOnly(ClientNumber,1)
ReadOnly(TaxYear,1)
}
May I also suggest, that you do not limit your forum queries to any one individual in the Subject line.
You are apt to get many more inputs from many users if you are open to all inputs.