******************************************************************** * Description.......: OpenTble && Opens the passed table * Calling Samples...: OpenTble('TranMstr','WorkFile') * Parameter List....: tcTable, tcAlias, tcMode, tcTagOrder, tnBufferMode * Created by........: * Modified by.......: Nadya Nosonovsky 01/10/2001 11:46:19 AM ******************************************************************** function OpenTble && Opens, but didn't select a table lparameters tcTable, tcAlias, tcMode, tcTagOrder, tnBufferMode *=messagebox( "tcTable "+tcTable+ chr(13)+"tcTagOrder "+iif(!empty(tcTagOrder),tcTagOrder,"")) * tcTable - required: name of table to open (with or without full path) * tcAlias - optional: alias name, if different from tcTable * tcMode - optional: mode in which table should be opened, like Shared noupdate * tcTagOrder - optional: Tag name * tnBufferMode - optional: Set buffer mode local lcTableName, lnPos, llDBCPrefix, lcDBCName * Check parameters first if empty(tcTable) or vartype(tcTable)<>'C' * First parameter is required return .f. else lnPos=rat('!',tcTable) if lnPos>0 && DataBase Name was specified && example: Support!PostOff lcTableName=juststem(substr(tcTable,lnPos+1)) && PostOff lcDBCName=upper(left(tcTable,lnPos-1)) && DBC Name llDBCPrefix=.t. else lcTableName=tcTable endif endif if empty(tcAlias) or vartype(tcAlias)<>'C' tcAlias=juststem(lcTableName) endif if empty(tcMode) or vartype(tcMode)<>'C' tcMode='shared' else tcMode=lower(tcMode) endif local lcCheckFile if empty(justext(lcTableName)) lcCheckFile=forceext(lcTableName,"dbf") else lcCheckFile=lcTableName endif if !file(lcCheckFile) && File doesn't exist =messagebox(tcTable +' does not exist!. Can not proceed...',48,'Error') return .f. endif local lnOldSelect lnOldSelect=select() if !used(tcAlias) or ; && Alias is not already in use or (llDBCPrefix and not juststem(cursorgetprop("DATABASE",tcAlias))==lcDBCName) && it's not the same database local lcOldError, lnErr, lcOldSetExclusive use in select(tcAlias) && Close table lnErr=0 lcOldError=on('error') && Save current Error Handler lcOldSetExclusive=set('exclusive') && Save current exclusive status set exclusive off && This should be always set this way on error lnErr=error() use (tcTable) again &tcMode in 0 alias (tcAlias) on error &lcOldError && Restore previous Error Handler if lcOldSetExclusive='ON' set exclusive on && Restore it back to original settings endif if lnErr<>0 && Error occurs if lnErr=1705 && File Access is denied =messagebox(tcTable +' is opened exclusively by another user. Can not proceed...',48,'Error '+transform(lnErr)) return .f. && Table could not be opened (already used exclusively) else && Another error =messagebox(tcTable+' could not be opened!',48,'Error '+transform(lnErr)) return .f. endif endif endif select (tcAlias) && If it's here, everything is all right if not empty(tcTagOrder) and vartype(tcTagOrder)='C' and tagno(tcTagOrder)>0 set order to tag (tcTagOrder) in (tcAlias) endif if vartype(tnBufferMode)='N' and between(tnBufferMode,1,5) set multilocks on =cursorsetprop('Buffering',tnBufferMode) && Note, we can not set buffering mode less than 3 on a view - no check for this endif select (lnOldSelect) && Return back to the original area return .t.>>>We have been receiving this 1705 error when trying to open a table exclusively and we're trying to track down the problem. This error is not consistent. It occurs once every two weeks.
>>> >>>Flush >>> >>>Sys(1104) >>> >>>>>Close Databases All >>> >>>If Used( ) >>> Use In >>>EndIf >>> >>>Use In 0 Exclusive >>> >>>>>>