I have not found a pattern with the exception that it always seems to happen on peer to peer networks. I have created ( I think I got most of this code from someone on UT) a trap to check when it happens. The code is fairly simple but it does work:
**********************
function tableCheck
lparameters cTable,cOpened
* compares size of table according to header and physical size
nowdbf=alias()
if PCOUNT()=1
use (cTable) in 0 again alias mytab
select mytab
else
SELECT(cTable)
endif
nRecCount = RECCOUNT()
nLogicalSize = HEADER() + (nRecCount * RECSIZE()) + 1
if PCOUNT()=1
USE IN mytab
endif
cOpen=cTable+'.dbf'
set compatible on
nPhysicalSize=FSIZE(cOpen)
set compatible off
IF VARTYPE(mytab)<>'U' AND USED(mytab)
USE IN mytab
endif
if !empty(nowdbf)
sele (nowdbf)
endif
* the file size on the server may not have been updated when a record
* is added to the table plus I think the problem is real only
* if the logical size is less than the file size.
if nPhysicalSize > nLogicalSize
return -1
else
return 1
endif
Whenever this returns -1 I tell the user to run database maintenance (Stonefields's tablerepair) which corrects the problem.
A problem is a problem only as long as it has a possible solution. Lacking that, it becomes a FACT!