DoCmd.DeleteObject acTable, "表名",如果是连接表,并不能“删除外数据库mdb的所有表或一个表”。
不妨调用下面的子过程试试:
Sub sbDeleteAllTables()
Dim db As Database Dim td As TableDef Set db = OpenDatabase("D:\Documents and Settings\GGLDD\My Documents\db1.mdb") For Each td In db.TableDefs If (td.Attributes And dbSystemObject) = 0 Then '不可删除系统表 db.Execute "Drop TABLE " & td.Name & ";" End If Next db.TableDefs.Refresh Set td = Nothing Set db = Nothing End Sub
|