> =messagebox(tcTable +' is opened exclusively by another user. Can not proceed...',48) > return .f. && Table could not be opened (already used exclusively)Unpost!!!!!!
******************************************************************** * Description.......: OpenTable * Calling Samples...: OpenTable('TranMstr','WorkFile') * Parameter List....: tcTable, tcAlias, tcMode * Created by........: ******************************************************************** function opentable lparameters tcTable, tcAlias, tcMode * tcTable - should be name of table to open (with or without full path) * database name should not be included with !, use gettable instead * tcAlias - optional alias name, if different from pcTable * tcMode - optional mode in which table should be opened, like Shared noupdate * Check parameters first if empty(tcTable) or vartype(tcTable)<>'C' return .f. endif if empty(tcMode) or vartype(tcMode)<>'C' tcMode='shared' else tcMode=lower(tcMode) endif tcAlias=iif(empty(tcAlias),juststem(tcTable),tcAlias) if !used(tcAlias) local fh if 'excl' $ tcMode && Esclusive mode was specified fh=fopen(forceext(tcTable,'dbf'),12) && Check, if table could be open exclusively if fh>0 and fclose(fh) && File could be opened exclusively use (tcTable) again &tcMode in 0 alias (tcAlias) else =messagebox(tcTable +' is opened exclusively by another user. Can not proceed...',48) return .f. && Table could not be opened (already used exclusively) endif else local lcOldError, lnVar lnVar=0 lcOldError=on('error') on error lnVar=error() use (tcTable) again &tcMode in 0 alias (tcAlias) on error &lcOldError if lnVar<>0 && Error occurs if lnVar=1705 && File Access is denied =messagebox(tcTable +' is opened exclusively by another user. Can not proceed...',48,'Error') return .f. && Table could not be opened (already used exclusively) else && Another error =messagebox(tcTable+' could not be opened!',48,'Error') endif endif endif else select (tcAlias) endif return .t.