>*-- using ADO >#DEFINE adSchemaTables 20 >oConnection = CreateObject("adodb.connection") >oConnection.Open("DRIVER={Microsoft Access Driver (*.mdb)};" +; > "Dbq=d:\vfpApps\northwind.mdb;" +; > "Uid=Admin;" +; > "Pwd=;") >oRS = oconnection.OpenSchema(adSchemaTables ) >oRs.Find("table_name = 'customers'") >llFound = IIF(oRS.EOF, .f., .t.) >>
>*-- using SPT > >*-- build connection string >lcConnectionStr = "DRIVER={Microsoft Access Driver (*.mdb)};" +; > "Dbq=d:\vfpApps\northwind.mdb;" +; > "Uid=Admin;" +; > "Pwd=;" >*-- connect to MDB >lnSql = SQLSTRINGCONNECT(lcConnectionStr) >*-- get tables of MDB into cursor >SQLTABLES(lnSql, "TABLE") >*-- check if table exists >LOCATE FOR UPPER(table_name)="CUSTOMERS" >IF FOUND() > *-- table exists >ELSE > *-- table doesn't exist >ENDIF >>