I was wondering as the code seems Ok but as already suggested by others there are better alternatives, if the problem doesn't come from the fact the user tries to push escape (he will usually push it several times as he may not get immediate reaction) when he gets 'Attemting to lock ... Esc to cancel'. It depends on how the escape key is handled but I wouldn't be suprised that he gets the cancel, ignore, help messagebox. If he hits ignore, he WILL pass by the FLOCK() and get a next key (remember a locked table remains readable to other users !!!)
My guess is : use RLOCK where the record is not readable nor writeable, but I don't if this would completely resolve the problem ...