OnInsert running twice for one insert

absolutelyfreewebabsolutelyfreeweb Member Posts: 104
edited 2013-06-01 in NAV Three Tier
If you do currpage.update in onopenform, you will get the strange behavior with oninsert running twice, but updating the record only once.

It executes once when the new button is pushed, and once when the actual insert occurs.

if you are using number series, the result is that it skips a number each time.

Anybody else experienced this? Seems like a bug to me. I'm running R2.

Comments

  • jglathejglathe Member Posts: 639
    Hi,

    OnOpenForm would be a trigger I wouldn't do an update. currpage.update has an optional parameter. Default behaviour is saving the record to the database, with implicitly calling the OnInsert trigger of the table. In the OnOpenForm trigger you have no actual record fetched from the database, you have one in the OnAfterGetRecord trigger. If there is no record in your SourceTableView, OnNewRecord gets called first.
    Wat do you want to do with the update in OnOpenForm?

    with best regards

    Jens
  • absolutelyfreewebabsolutelyfreeweb Member Posts: 104
    ah thanks. only meant refreshing the form itself with correct control statuses.
Sign In or Register to comment.