ACCESS數據庫清空?
窗體上畫一command,數據庫為a ,表名為b
Private Sub Command1_Click()
Dim msgQk
msgQk = MsgBox("清空數據庫將清除所有數據!", 32 + vbOKCancel, "請選擇")
If msgQk = 1 Then
Dim cnDel As New ADODB.Connection
Dim rDel As New ADODB.Recordset
Dim sqlDel1 As String
cnDel.Open "DBQ=" & App.Path & "\a.mdb;Driver={Microsoft Access Driver (*.mdb)};"
sqlDel1 = "delete * from b"
cnDel.Execute sqlDel1
MsgBox "數據庫清空完成!", 32, "完成"
cndel.close
End If
End Sub