>>>=OpenFile(ddir,'POLICY_D','MASTER',.T.,'SYSNUM') >>>=OpenFile(scdir,'POLICY_D','SCMAST',.F.,'SYSNUM') >>>=OpenFile(ddir,'POLICY_H') >>> >>>*--Process runs here >>> >>>CLOSE TABLES && appears to close all tables in the default data session but not alias 'MASTER' >>> >>>*--the first openfile line below fails because master is still open from above - close tables >>>*--did not close it for some reason? I have stepped through this and each line is processed >>>*--but master remains open and the data session is still the default data session >>>*--_vfp.autoyield should have any effect here >>> >>>=OpenFile(ddir,'POLICY_D','MASTER',.F.,'SYSNUM') && master is in still use for some reason? >>>=OpenFile(scdir,'POLICY_D','SCMAST',.F.,'SYSNUM') >>> >>>*--Another process runs here >>> >>>CLOSE TABLES >>>RETURN >>> >>>*-------------------------------------------------- >>>FUNCTION OpenFile >>>PARAMETERS sDir, sFile, sAlias, bZap, sOrder >>> >>>IF EMPTY(sAlias) >>> sAlias = sFile >>>ENDIF >>> >>>llFailed = .F. >>> >>>TRY >>> >>> SELECT 0 >>> USE (sDir+sFile) EXCLU ALIAS (sAlias) >>> >>>CATCH TO ErrObj >>> >>> MsgText = "Error "+TRANSFORM(ErrObj.ERRORNO)+": "+; >>> ErrObj.MESSAGE +; >>> CHR(13)+CHR(13)+; >>> IIF(ErrObj.ERRORNO = 1705,'Could not open the file:'+CHR(13)+; >>> sDir+sFile+CHR(13)+'excusively.'+CHR(13)+CHR(13),; >>> 'Could not open the file:'+CHR(13)+; >>> sDir+sFile+CHR(13)+CHR(13)) >>> MESSAGEBOX(MsgText, 0+16+4096,'Error') >>> llFailed = .T. >>> >>>ENDTRY >>> >>>IF !llFailed >>> IF !EMPTY(sOrder) >>> SET ORDER TO TAG (sOrder) >>> ENDIF >>> >>> ON ERROR DO sysErrMess IN MAIN WITH ; >>> ERROR(), MESSAGE(), MESSAGE( 1), PROGRAM(), LINENO() >>> >>> IF bZap >>> ZAP >>> ENDIF >>> >>> RETURN >>>ELSE >>> >>> ON ERROR DO sysErrMess IN MAIN WITH ; >>> ERROR(), MESSAGE(), MESSAGE( 1), PROGRAM(), LINENO() >>> >>> StopLoop = .T. >>> >>>ENDIF >>> >>>RETURN >>>