在不使用AddNew或Edit情况下,更新Update或取消更新CancelUpdate" 的错误提示对话框
Private Sub cmddao_Click()Dim rs1 As Recordset
Dim db1 As Database
Set db1 = OpenDatabase("C:\db1.mdb")
Set rs1 = db1.OpenRecordset(Name:="Ruku", Type:=dbOpenDynaset)
With rs1
.FindFirst "商品名称='" & [C8] & "'"
If rs1.NoMatch = True Then
.AddNew
.Fields("商品名称") = [C8]
.Fields("型号") = [C10]
.Fields("数量") = [C12]
.Fields("单价") = [C14]
.Fields("金额") = [C16]
.Update
.Close
Else
.Fields("商品名称") = [C8]
.Fields("型号") = [C10]
.Fields("数量") = [C12]
.Fields("单价") = [C14]
.Fields("金额") = [C16]
.Update
.Close
End If
End With
db1.Close
Set db1 = Nothing
Set rs1 = Nothing
End Sub
程序运行到黄色代码段时,弹出"在不使用AddNew或Edit情况下,更新Update或取消更新CancelUpdate" 的错误提示对话框.
烦了偶一天了.
请高人指点,谢谢!