Hello,
I have a "semaphore" file, ReserveGroup.DBF; it has one integer field,
GROUP, which is also it's primary index, GROUP.
While reservations are being changed in a group, the function LockGroup is
called; a record in this table is created (if none exists) with the group
number and the record is locked. Once the reservation changes have been
completed, the record is unlocked.
Sometimes, the system generates the error "Uniqueness of index GROUP is
violated" (the error shows in ther error log - 11 times in June, 5 times so
far in July; different users, different computers). I can't reproduce this
problem.
ReserveGroup is opened in the Data Environment of the form, w/buffer mode of
0, and it's order set to GROUP.
This is a peer-to-peer Windows network.
The error occurs at line 10 in the following function...does anyone have any
suggestions about how to avoid the error?
TIA, J
FUNCTION LockGroup
LPARAMETER nGroupToLock
LOCAL cTheAlias, lLocked
cTheAlias = ALIAS()
SELECT ReserveGroup
IF !SEEK( nGroupToLock )
INSERT INTO ReserveGroup VALUES ( nGroupToLock )
ENDIF
IF LOCK()
lLocked = .T.
ELSE
lLocked = .F.
WAIT WINDOW RecBusyMsg
ENDIF
SELECT ( cTheAlias )
RETURN lLocked