Update form after table trigger OnModify

elToritoelTorito Member Posts: 191
Hi,

in one of my Tables I have a OnModify Trigger where i put new Date and Time for my data record.

I use a Form for Change the Data Record, when i edit the record with the form the date and the time will changed in table, thats is correct.

In my Form i have two textboxes where i read the date and the time of the data record, but after change the record it doesn't update. Only when i go out of the form and open it again or i scroll forward or back data records.

What must i do so that this fields are changed at the moment when i edit the record ?

Thanks
(Oo)=*=(oO)

Comments

  • RobertMoRobertMo Member Posts: 484
    The OnModify trigger for the record happans only when you are leaving record (close/open or scroll up/down and back).

    I suggest you put the code OnValidate (on each field of your table - or at least on fields you are changing and want to change date time fo rec) you don't need the code onModify.
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • DenSterDenSter Member Posts: 8,307
    And to answer your question....

    To make the form refresh after a field is validated, you put CurrForm.UPDATE into the field's OnAfterValidate trigger.
  • RobertMoRobertMo Member Posts: 484
    Actually CurrForm.UPDATE is (usually) not needed. The controls that show field values of froms "rec" are refreshed automatically.
    Even if you have some controls to show globals on form that are changed, you don't have to call CurrForm.UPDATE. But not allways.

    It's kind of hard to explain exactly when do you need to call and when not. Usually you try without CurrForm.UPDATE and if changes are not seen you try with CurrForm.UPDATE. Sometimes even that doesn't help.
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • DenSterDenSter Member Posts: 8,307
    you're right, you don't always need the CurrForm.UPDATE, and it also doesn't always work. Just try these things until it works for you. When it does, stop trying and take a break :D . At some point you'll get used to Navision's funky ways.
  • elToritoelTorito Member Posts: 191
    Thank you for the answers.
    (Oo)=*=(oO)
Sign In or Register to comment.