No announcement yet.

how to make ID (auto increment) appear before save / commit

  • Filter
  • Time
  • Show
Clear All
new posts

  • how to make ID (auto increment) appear before save / commit

    how to make ID (auto increment) appear before save / commit?

  • #2
    Explain better what do you want to achieve, id is already auto incremented by your db when commit occurs.


    • #3
      Hi Clauu,

      You right what id is auto incremented BY DB when commit occurs. But I want it to appear on the form before commit (add button).


      • #4
        Then you'll have to add a new field visible ony in insert mode and in a event like onload set that field with the latest id from db or use the grid lookup


        • #5
          If you are using an auto increment field you simply cannot. If you use a simple integer you can do a select max(myid) from mytable to get the highest available key and add 1 to it. You can do this in the onload event.

          I strongly recommend *not* using this technique if more than one user can access your application. Suppose two people want to add a record. As long as the new number is not inserted both will get the same key. ONe can save, the other will get a duplicate key error.
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development


          • #6
            Makes sense. Thanks Albert.