do not add, but use the SerialIncrement function.
Brilliant.... Job done
Thanks for your help
I have made a script that writes the job number from the last record to a global field.
This doesn't seem to be a reliable method. Why don't you set the field to auto-enter a serial number?
Thanks for the input.
What I finally ended up doing was using a global field to set the users job number.
On a new record, the global field gets entered into a "Job" field.
A script then sets the Job field using the SerialIncrement and adds 1 to the value.
Then the global field gets set to the new job number.
It appears to be working fine.
I am not getting where exactly is the previous number coming from, but you need to consider what happens when the last record is not the current record (perhaps not even in the current found set), or when a record is deleted, or when two users are creating a new record at the same time, and so on.
I have a layout that has the user fill in pertinent information. All that data gets set in Global fields. eg. One field is "Select a number to use for your report" The user enters 22ght01 This gets set to the Global field "job"
When the user starts a new record, a script runs and takes the global field "job" and adds 1. with the SerialIncrement function.
This value is then set into a field called "job number"
The field "job number" then replaces the global field. So, when the user enters another job the global field is used + 1
It all seems to work just fine.
This is a single user application, so no worries with multi users.