[eluser]arthurhanlon[/eluser]
It'll probably help to give you guys a little more info.
The app is to keep track of product returns and missing goods and essentially, each record will have a unique number along the lines of RMA100011, RMA100012 etc. This I suppose could well be the primary key BUT, doesn't necessarily have to be. I was thinking of having a separate primary key.
The thing I am finding hard to figure out is that the user inputting a new record must pass this unique number (RMA100011) onto the customer so that they have a unique reference. The unique number would therefore be created when the record was created but not saved into the DB until the record was complete and the details were saved.
The problem, I guess, is how can I effectively 'reserve' the unique number while the record is being created so that if another user tries to create an entry, they are given the next number in the sequence?
I thought of storing the newly created records in a temporary table then when the record was saved, remove them from this table and port them over to the correct table. This would keep the sequence going and allow me to generate new numbers easily. If a user then cancels the creation of the new record, the number is removed from the temp table and the record is discarded.
The crux of it is that the user needs to be aware of the number when entering/after saving the record to pass this onto the customer.
Sorry, I have a tendancy to waffle on but I hope that gives a slightly clearer picture of what I am trying to do.
Cheers,
Arthur