用VBA代碼刪除外部數據庫的表

用VBA代碼刪除外部數據庫的表,第1張

用VBA代碼刪除外部數據庫的表,第2張

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

位律師廻複

生活常識_百科知識_各類知識大全»用VBA代碼刪除外部數據庫的表

0條評論

    發表評論

    提供最優質的資源集郃

    立即查看了解詳情