I have a form (table 1) with subform (table 2), after I get record for form (from table 1), i need to modify some rows in record for subform (modify table 2) and then show them in subform,
When i try to modify table 2 in AfterGetRecord in form, it ends up with error message - "You can not modify database by this activation signal" (I dont know exactly how it is in english, this is my translation of czech error message).
Is any way to modify table in subform when changing record in form ?
Thank you,
0
Comments
Have you tried the onaftergetcurrrecord trigger?
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Updating all values before form is opened is not good idea, that could take too much time, so i need to recalculate only values that are needed after record in form is selected (form = header, subform = rows).
And i wonder if it is possible or not.
Thanks.
See Form 498 for what to put in the "OnFindRecord","OnNextRecord"-triggers.
In the subform, you need to put a function that will be called from the main form. This function fills up the temptable and you can give the order you like.
In the main form, you have to give your subform a name.
In the "OnAfterGetCurrentRecord"-trigger of main form, you can call the function in the subform (something like "CurrForm.MySubForm.FORM.TheFunction")
The only problem with a temptable in a form, is if the user changes the records. In this case you have to write some code to apply the changes to the real table.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
As you can see, it is not so easy. Yes, you need to do that in another way. For now, I mean that krikis' method is best. May be that you will find another way. For example you can add code into OnTimer and call this update functions from there if the Header record was changed (to prevent recalculations when user did not select another record...). It means, that lines will be updated for example 1 second (you can call it after 0,5 sec etc.) after you selected the record, but may be that it is enough for the user.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.