llOk = .T. lcOldErrorRoutine = on( "error" ) begin transaction llSuccess = TableUpdate() if not llSuccess aerror( laError ) if laError = 1884 */ Uniqueness error number */ RE-Generate new number... llOk = .F. endif endif rollback on error &lcOldErrorRoutine return( llOk )You may or may not want to rollback depending on when the attempt is being checked... I would try it during a loop when determining the next available number... Then check again when user tries to save the changes.