How to refresh subform from table?

I have a subform linked to a table. After user insert one record at subform, my application will auto-generate some records in this table. But the problem is, after these records are created, the subform doesn’t refresh. User need to move the mouse and click somewhere else, then all of those records will appear. I generate these records in the trigger of table, so I cannot use CurrForm.Update to refresh the subform. Any solutions?

You can add a function in the subform that calls currform.update, and then call the function from the main form. Try the following on a sales Order Form. On the Sales Order Sub Form, add the following function **RefreshForm()** CurrForm.UPDATE(FALSE);then place the following code (for example) on a button on the Sales Order Header**OnPush()** SL."Document Type" := "Document Type"; SL."Document No." := "No."; SL."Line No." := 10000; SL.Description := 'New Line'; WHILE NOT SL.INSERT DO SL."Line No." += 10000; CurrForm.SalesLines.FORM.RefreshForm;Should work, let me know.

Thanks, David. I think your code definitly can work. But my problem is I create records in a trigger of Sales Line table instead of in the trigger OnPush in your example. My code likes: Item No. - OnValidate() SL.“Document Type” := “Document Type”; SL.“Document No.” := “No.”; SL.“Line No.” := 10000; SL.Description := ‘New Line’ I cannot use CurrForm.Refresh in this table trigger because the form object cannot be accessed from here.

Try in the onaftervalidate trigger of “No.” Also what is “Item No.”, there is no Item no field in a sales line?

“Item No.” is just an example. It is actually a field. I try to use CurrForm.Update in the OnAfterValidate trigger, it works! Thanks. :slight_smile:

great another satisfied customer.