Sub 连接数据库()
'引用
'1、创建连接对象
Dim con As New ADODB.Connection
'2、连接数据库
With con
.Provider = "microsoft.ace.oledb.12.0"
.ConnectionString = ThisWorkbook.Path & "\学生管理.accdb "
.Open
End With
'3、删除记录 delete from 表名[where 条件]
Dim sql As String
sql = "delete from 院系 where 院系编号 = 'A07'"
con.Execute (sql)
'4、释放空间
con.Close
Set con = Nothing
End Sub