Private Sub Command3_Click()
'删除
If Text1.Text <> "" And Text1.BackColor = vbYellow Then
sd = InputBox("请输入管理员密码:", "密码", "a123")
If sd = "a123" Then
Dim SQL As String
a = Text1.Text
Set cnn = CreateObject("ADODB.Connection")
'创建数据库连接
cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\钢网库.accdb;Jet OLEDB:database password=793192"
SQL = "delete from 钢网清单 where 钢网ID like'%" & a & "%'"
cnn.Execute SQL
cnn.Close
Set cnn = Nothing
Text1.Text = "": Text1.BackColor = vbWhite
Text5.Text = "": Text5.BackColor = vbWhite
Text6.Text = "": Text6.BackColor = vbWhite
Text7.Text = "": Text7.BackColor = vbWhite
Text8.Text = "": Text8.BackColor = vbWhite
Text9.Text = "": Text9.BackColor = vbWhite
Text4.Text = "": Text4.BackColor = vbWhite
Text10.Text = "": Text10.BackColor = vbWhite
MsgBox "删除完毕!", 64, "提示"
Else
MsgBox "密码错误!", 17, "提示!"
Exit Sub
End If
Else
MsgBox "请输入钢网ID再删除!", 17, "提示!"
Exit Sub
End If
End Sub
仅供参考...