以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于窗口的保存按钮  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=145847)

--  作者:andyd
--  发布时间:2020/2/9 14:37:00
--  关于窗口的保存按钮
想通过窗口的按钮在生产填写记录表时同时生成产品记录,请问如何判断“产品记录”中存在该 卷号 时不新增而是更新该条记录?
谢谢!!
按钮代码:
Dim cr As Row = Tables("产品记录").Current
Dim nr As Row = Tables("收卷记录").AddNew
    nr("卷号") = cr("卷号")
    nr("收卷记录1") = cr("质量记录1")
    nr("收卷记录2") = cr("质量记录2")
    nr("收卷记录3") = cr("质量记录3")
[此贴子已经被作者于2020/2/9 14:38:15编辑过]

--  作者:有点蓝
--  发布时间:2020/2/9 22:24:00
--  
Dim cr As Row = Tables("产品记录").Current
dim nr as datarow = DataTables("收卷记录").find("卷号=\'" & cr("卷号") & "\'")
if nr is nothing then 
    nr = DataTables("收卷记录").AddNew
    nr("卷号") = cr("卷号")
end if
    nr("收卷记录1") = cr("质量记录1")
    nr("收卷记录2") = cr("质量记录2")
    nr("收卷记录3") = cr("质量记录3")