PUBLIC nCount, gnDbcnumber, gaDatabase[1], gnBadCount * Redirect our error handler to display relevant information ON ERROR DO flagError WITH gaDatabase[nCount, 1] * Get directory of all DBF files gnDbcnumber = ADIR(gaDatabase, '*.DBF') * Loop for number of tables to find bad ones gnBadCount = 0 FOR nCount = 1 TO gnDbcnumber * Try to open it USE (gaDatabase[nCount, 1]) IN 0 ALIAS thisDbf * If it opened, close it IF USED("thisDbf") USE IN thisDbf ENDIF NEXT * Restore our error handler ON ERROR * Tell the user how it went ? IIF(gnBadCount = 0, "No errors", TRANSFORM(gnBadCount) + " tables could not be opened") FUNCTION flagError LPARAMETERS pcTable * Note: you could add additional passed parameters to verify the error message, etc. ? "Table " + pcTable + " is bad" gnBadCount = gnBadCount + 1