How do I halt a script if a field value already exists?
I'm working on a database that was created in an old version of FM. There are several files, one per table. It has since been upgraded to FM7.
There is a file for Jobs and one for Invoices.
I've created a script to create invoices using a number from Jobs.
The script copies a number from the Jobs file. It then opens the invoice file and launches a script. The invoice file's script creates a new record and pastes the number in the proper field.
The problem is that if the number already exists, I end up with a blank record and "INVOICE NUMBER” is defined to contain unique values only. You must enter a unique value.
How can I tell the script to end if the number already exists?