应该比较简单
1、使用ADO对象删除,Access 2007 以上版本数据库

程序代码:
Private Sub Command1_Click()
If Val(Text1.Text) < 1 Then
MsgBox "你没有输入需要删除的ID号,请填写!", 16, "无法删除!"
Exit Sub
End If
Dim cn As New ADODB.Connection, RS As New ADODB.Recordset
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\用户信息.accdb;Jet OLEDB:Database Password=;"
RS.Open "Select * From 用户表 where ID=" & Val(Text1.Text) & "", cn, 3, 2
RS.Delete '删除指定记录
RS.Close
cn.Close
MsgBox "数据表用户表中ID=" & Val(Text1.Text) & "的记录已经删除!", 64, "删除成功!"
End Sub
2、使用ADO控件删除,Access 2007 以上版本数据库

程序代码:
Private Sub Command2_Click()
If Val(Text1.Text) < 1 Then
MsgBox "你没有输入需要删除的ID号,请填写!", 16, "无法删除!"
Exit Sub
End If
Adodc1.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\用户信息.accdb;Jet OLEDB:Database Password=;"
Adodc1.RecordSource = "Select * From 用户表 where ID=" & Val(Text1.Text) & ""
Adodc1.Recordset.Delete '删除指定记录
Adodc1.Recordset
MsgBox "数据表用户表中ID=" & Val(Text1.Text) & "的记录已经删除!", 64, "删除成功!"
End Sub
[此贴子已经被作者于2020-7-11 12:24编辑过]