Update a main-form from a subform

Where would I have been without this forum??? I have some problems with a main-sub form. On the main-form (Source=Table1) I have a flowfield with data from the subform(Source=Table2). I want to be able to edit the data on the sub-form and the flowfield should be correspondingly updated. But if I try modifying on the subform, I get the message “Another user has modified the record for Table1…” - this user is me!!! Therefore, I need a way to update the main-form after modifying the sub??? Any suggestions?

Hi Jens, Search for ‘Mainform update’, and you’ll get a whole lot of topics on this subject. But I think that the error-message is caused by the way your calc-formula is defined (or perhaps the table link). I just tried to put the default field “Amount” on a Purchase-invoice (header), and when I entered a line, the field was updated with out problems, when I moved focus to the header. regards Alexander

Hi Jens, I guess you have a ‘modify-command’, but Flow-fields in forms are updated automatically by Navision. So, if true, delete the modify-command. Michael

Thanks to Michael and Alexander… I need to add a thing to my problem…When I make a change on the subform (Table2) I have a function which updates another field on all the lines in the subform - I think that is why I get the ERROR? The solution would be to update the form after I have run the function. Maybe I should put the function directly on the subform (but where?) instead of OnValidate() on Table2??

Hi Jens, I’m a litle confused now. The fact that you have a function update all records in your Sub-form (table2), would lead me to expect the ERROR to relate to table2, and not table1 as you descripe. Updating a flow-field is never seen as a modification af the record. I would try a CurrForm.UPDATE(TRUE); in the OnAfterValidate-trigger of the field that causes the update-function to run. (I’m not sure if it’ll work, though) If it is possible for you, you’re velcome to mail me the objects and I’ll have a look at it. regards Alexander

Hi Alexander Sorry - the error belongs to Table2, so the error-message would be: “Another user has modified the reord for table2…” The CurrForm.UPDATE(TRUE)-trick doesn’t work so I guess that the user just has to use a F9-update function on the main-form (which works!!) instead - allthough it would have been great if the subform would be automatically updated on changes…

Hi Jens, I’m sure it is possible to make it the way you wish, but I don’t think I’m skilled enough to tell you exactly what to write, and where. I would have to use the “Trial N’ Error”-method myself. Instead of having the update-function called on the table-trigger OnModify, I would try moving it to the form (as you suggest yourself). There is also a trigger here, related to the modification of the record. Then I would first try this: CurrForm.SAVERECORD(); FunctionCall(); CurrFOrm.UPDATE(); And if that didn’t work, I would mengle it a little around, until I got it right. :wink: On the other hand, there must be someone else in this Forum, who can tell whether or not I’m totally off. regards, Alexander