|Subject||Re: [IBO] Looking for rationale...|
----- Original Message -----
From: "Alan McDonald" <alan@...>
> I have a need for users to enter ten or fifteen records a month into a
> which requires them entering barcodes numbers (generated by a third
> There is a unique constraint on the barcode field.
> I can catch a duplicate with OnError testing for ERRCODE:335544665 and
> showing a message, rollingback the transaction but:
> this means they will loose previous correct data as well as the duplicate
> attempt. I suppose I can try to commit after post and start a new
> transaction for each record entry...
> I can ask that they enter all barcode numbers before they enter details
> each record. This will avoid them loosing valid records in the same
> transaction as invalid records.
You could use a non dataware control as TEdit to enter the codes. After
detect a <enter> on event OnKeyPress you could use a tib_cursor to verify if
the code is unique on the table and take the appropriate action. You would
need only a transaction with autocommit=False with all tib_datasets bound to
this transaction. After all issue a commit for all inserts.