我的思路是
name行发生变化后
1 判断 输入的name是有内容在 proudct
有 。。。。
没有 提示添加商品
2 判断 输入的name是否在 (weixindanhao.wexin)表 有相同的name
if 有 就不添加新的行(或者添加后 删除)
然后在原先的 行的shuliang 加1
if 没有 就添加新的行
脑子不好用,请各位大神指点
If e.DataCol.Name="name"
Dim dr As DataRow = DataTables("product").Find("[shangpinming] = '" & e.NewValue & "'")
If dr IsNot Nothing Then
e.DataRow("cord") = dr("cord")
e.DataRow("markprice") = dr("markprice")
e.DataRow("price") = dr("sellprice")
e.DataRow("kg") = dr("kg")
e.DataRow("name") = dr("shangpinming")
Else
If dr Is Nothing Then
messagebox.show("没有此商品 请在入库单先入库")
forms("商品").open ' e.Cancel=True
End If
End If
End If
If e.DataCol.name="name" Then
Dim r As Row = Tables("weixindanhao.weixin").Current
Dim idx As Integer = Tables("weixindanhao.weixin").FindRow("name = '" & r("name") & "' and [_Identify] <> " & r("_Identify"))
If idx >= 0 Then
msgbox("已存在")
Tables("weixindanhao.weixin").Rows(idx)("shuliang") += 1
r.delete
End If
End If