>parameters mdbcname >mdbcname=(sys(5)+alltrim(sys(2003)))+'\TABLES\ACWS.dbc' > >if empty(mdbcname) > return >endif > >close all >close data > >open database (mdbcname) excl >= adbobjects(latablearray, "TABLE") > >for i=1 to alen(latablearray) && loop through each table in the array > mtablename=latablearray(i) && pick up table name from array > =opentable(mtablename) && attempt to open table >next x > >procedure opentable >parameters M.table > >x=0 >on error x=error() >use (M.table) in 0 >on error > >if x<>0 && Possible table corruption > local lnhandle,ix > lnhandle = fcreate("c:\Baddbf.txt") > do case > case "corrupt"$message() > =fputs(m.lnhandle,"Table "+m.table+" is corrupt!",48,"Unable to open table") > case "does not exist"$message() > =fputs(m.lnhandle,"Table "+m.table+" does not exist",48,"Unable to open table") > case x=1705 or "cannot access"$message() > =fputs(m.lnhandle,"Table "+m.table+" does not exist",48,"Unable to open table") > otherwise > =fputs(m.lnhandle,"Table "+m.table+": "+message()+"!",48,"Unable to open table") > endcase > =fclose(m.lnhandle) >endif >
IF NOT FILE("c:\Baddbf.txt") lnhandle = fcreate("c:\Baddbf.txt") ENDIFUse FOPEN() for R/W (see help for parameters)
if empty(mdbcname) return endifIs meaningless as it will never run because you are setting the DBC name on top