*!* Thisform.cmdGaps.RightClick() * This method looks for skipped dts numbers in the dts table, and looks for a corrupt index. * It stores missing numbers, if any, in \data\dtskip.txt LOCAL lMissingArray,nNext, nHandle, fMissing, nPriorNum, cTxtFile LOCAL nStartNum ThisForm.OptGrpIndexes.Option1.Click() fMissing = .F. nStartNum = INT(VAL(ThisForm.txtFind.VALUE)) cTxtFile = gcDefaultDir + "\data\dtskip.txt" nHandle = FCREATE(cTxtFile,0) IF nHandle = -1 Wait "Can't open " + cTxtFile Window RETURN ENDIF ON ERROR FCLOSE(nHandle) *ThisForm.MousePointer=11 SELECT DTS SET ORDER TO TAG DTSNUM IF nStartNum = 0 LOCATE SKIP && the first two records are temp records. skip them SKIP ELSE SET NEAR ON =SEEK(nStartNum,"DTS","DTSNUM") SET NEAR OFF ENDIF nNext = DTS.DTSNUM + 1 && load what should be next number in sequence DO WHILE NOT EOF("DTS") WAIT STR(DTS.DTSNUM) WINDOW NOWAIT IF DTS.DTSNUM > nNext && a gap exists, save number and set missing flag DO WHILE DTS.DTSNUM > nNext =FPUTS(nHandle,STR(nNext)) nNext = nNext + 1 ENDDO fMissing = .T. ELSE && no gap, set next expected number, save cur number as priornum nNext = DTS.DTSNUM + 1 nPriorNum = DTS.DTSNUM SKIP IF DTS.DTSNUM < nPriorNum AND NOT EOF("DTS") * number out of sequence! fMissing = .T. =FPUTS(nHandle,"DTS table and/or index is corrupt") EXIT ENDIF ENDIF ENDDO IF fMissing = .F. =FPUTS(nHandle,"No Gaps found in DTS") ENDIF =FCLOSE(nHandle) ON ERROR WAIT CLEAR IF fMissing = .F. =MESSAGEBOX("No Gaps found in DTS") RETURN ENDIF CD (gcDefaultDir +"\data") temp = gcDefaultDir+"\DATA\dtskip.txt" RUN /N C:\Program Files\Accessories\WORDPAD.EXE &temp CD (gcDefaultDir)Hope it is of some help.