Foxtable(狐表)用户栏目专家坐堂 → 两表对应问题


  共有1855人关注过本帖树形打印复制链接

主题:两表对应问题

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107671 积分:547676 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/4/27 10:27:00 [显示全部帖子]

产品信息表datacolchanging事件
if e.datacol.name = "产品名称" andalso e.newvalue is nothing then
    if datatables("库存信息表").find("产品名称='" &e.oldvalue  & "'") isnot nothing then
msgbox("有库存,不能删除")
       e.cancel = true
   end if
end if

产品信息表datacolchanged事件

if e.datacol.name = "产品名称"
    dim dr as datarow = datatables("库存信息表").find("产品名称='" & e.oldvalue  & "'")
    if dr isnot nothing then
        dr("产品名称") = e.newvalue
    else
        dr = datatables("库存信息表").find("产品名称='" & e.newvalue  & "'")
    if dr is nothing then
dr = datatables("库存信息表").addnew
        dr("产品名称") = e.newvalue
    end if
    end if
end if

BeforeDeleteDataRow事件
    if datatables("库存信息表").find("产品名称='" & e.datarow("产品名称") & "'") isnot nothing then
msgbox("有库存,不能删除")
       e.cancel = true
   end if

建议还是使用产品编码进行关联,因为如果还有采购订单、销售订单、调拨单等等各种明细也有这个产品名称,难道全部都要改里面的产品名称?这个是不合理的

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107671 积分:547676 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/4/27 15:08:00 [显示全部帖子]

这个改不了

 回到顶部