function TableExists(TableName:string):Boolean; var str:string; begin str:='SELECT * FROM sysobjects WHERE name ='+''''+TableName+''''; DM.qry1.Close; DM.qry1.SQL.Clear; DM.qry1.SQL.Add(str); DM.qry1.ExecSQL(False); if DM.qry1.RecordCount=1 then Result:=True else Result:=False; end;