'删除整个表
Sub DropX2()
Dim dbs As Database
'在您的计算机中修改此行使其正确指到 Northwind 的路径。
Set dbs = OpenDatabase("Northwind.mdb")
' 删除员工表。
dbs.Execute "DROP TABLE Employees;"
dbs.Close
End Sub
'删除记录的两个例子
1、
Public Sub DeleteX()
Dim rstRoySched As ADODB.Recordset
Dim strCnn As String
' Delete the record.
rstRoySched.Delete
rstRoySched.Update
rstRoySched.Close
End Sub
2、
Public Sub DeleteX()
Dim cnn As ADODB.Connection
cnn.Open "Provider=sqloledb;" & _
"Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
cnn.execute "delete form 表 where id=2"