想做个数据库更新按钮,请高手指点:Private Sub Command_UPDATA_Click()Dim myval As StringIf Text1.Text = "" Or Combo1.Text = "" Then
MsgBox "Please input Material Number.And Device Process Type"
Else
Set rs = cn.Execute("select * from MaterialNo WHERE [MaterialNo]='" & Text1.Text & "'")
If rs.EOF Then
myval = MsgBox("Save New Material Number?", vbInformation + vbYesNoCancel, "Notice :")
If myval = vbYes Then
cn.Execute ("insert into MaterialNo values('" & Text1.Text & "','" & Combo1.Text & "')")
MsgBox ("Add New Complete!")
Adodc1.Refresh
Call Command_Refresh_Click
Else
Text1.Text = ""
End If
Else
Text1.Text = ""
Combo1.Text = ""
End If
End IfEnd Sub
MsgBox "Please input Material Number.And Device Process Type"
Else
Set rs = cn.Execute("select * from MaterialNo WHERE [MaterialNo]='" & Text1.Text & "'")
If rs.EOF Then
myval = MsgBox("Save New Material Number?", vbInformation + vbYesNoCancel, "Notice :")
If myval = vbYes Then
cn.Execute ("insert into MaterialNo values('" & Text1.Text & "','" & Combo1.Text & "')")
MsgBox ("Add New Complete!")
Adodc1.Refresh
Call Command_Refresh_Click
Else
Text1.Text = ""
End If
Else
Text1.Text = ""
Combo1.Text = ""
End If
End IfEnd Sub
表里含有两个内容MaterialNo和VER是相互对应的。有时候需要修改其中一项,但是希望两项同时改变。