How, when opening a form, a non-editable field, display the next number (PK) of my Database?
In addition, we have a problem with the duplicity, because if 2 people open the Form while both may end up getting the same number and this can not happen.
Depending on your database, you cannot predict the next number in a autonumeric PK. When using MySQL, the next number is generated based on the table. When using PostgreSQL, the number is a result from a corresponding sequence, if you want to know the next number you can simply refer to the sequence SELECT NEXTVAL() FROM sequence_name....BUT, when you refresh your form the sequence will generate a next number.
When simply adding +1 to the MAX(pk) you will finally enter a problem because people will get the same number....so in this context it's not really possible to achieve this. The final number of a REAL autonumeric column will AND SHOULD be generated by the databasesystem.
Please make sure that normal autonumeric PK's are mostly used to identify records and are not shown to (end)users...it shouldn't matter if there are "holes" in the sequence, it's just an identifier.
Maybe it's an idea to create a form in 2 steps, 1 form to create the record and then immediately return into edit-mode. The new record is created and can be editted.