How to differentiate form mode

Hello,

I have created basic forms from available SQl file. My requirement is how do i differentiate the form “Mode” so that i can decide on my logic.

  1. A user should not be able to modify entries by other user
  2. If a “Add New” button is clicked, then it is a new entry. How do i know this difference…that is form opened for viewing and form opened for new entry

Hope my question is clear. It may be simpler but i’m in need of help

THanks

1.- Then you must to add your logic on onBeforeUpdate checking if active user was who created the record, and allow or deny.
2.- Right now I don’t know if exists a way to do it via variables or macros, I didn’t needed, but, like always I did…

if ({idField}>0) 
//update 
else
//new record

  1. You need to keep track of the owner of the record. So you need to store the userid into the record and use the onrecord event to show the user if the record is editable. In the onvalidate or onbeforeupdate you check if the user is allowed.
    2.Look at the macro’s, there’s a macro to find out which button (insert/update) was clicked. You use that in the onvalidate event.

If you have setup your data dictionary you can go there and open the tables one by one. With cut and paste you can retrieve a lot of the field names. If you don’t have that you need to go to applications you have created (if any…) then you can go to the sql section and extract the fieldnames from there. Otherwise I dunno I’m affraid.