用VBA代碼刪除外部數據庫的表
DoCmd。DeleteObject acTable,“表名”,如果是連接表,則不能“刪除外部數據庫mdb的所有表或一個表”。
嘗試調用以下子流程:
Sub sbDeleteAllTables()
Dim db As Database
Dim TD As TableDef
Set db = open Database(" D:\ Documents and Settings \ ggl DD \ My Documents \ db1 . MDB")
for db . tabledefs
if(TD . attributes and dbsystem object)= 0 then ' the system table
db . execute" drop table" & TD . name &";
End If
Next
db。TableDefs . Refresh
Set TD = Nothing
Set db = Nothing
End Sub
0條評論