以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=191899)

--  作者:WXF01541
--  发布时间:2024/5/14 16:48:00
--  [求助]
有A表和B表,两个表都有客户代号和客户图号两列,如何实现在A表输入客户代号和客户图号后,如果在B表无对应客户代号及客户图号会自动添加,否则不添加
--  作者:有点蓝
--  发布时间:2024/5/14 16:54:00
--  
类似:http://www.foxtable.com/webhelp/topics/1451.htm

表A,datacolchanged事件
Select Case e.DataCol.Name
    Case
 "
客户代号","客户图号"
        
Dim dr As DataRow = e.DataRow
        
Dim pr As DataRow
        
If dr.IsNull("客户代号")=false andalso dr.IsNull("客户图号"=false Then
            
Dim filter As String
            filter = 
"客户代号 = \'" & dr("客户代号") & "\' And 客户图号 = \'" & dr("客户图号") & "\'"
            pr = 
DataTables("表B").Find(filter)
            If pr Is Nothing Then
                pr = DataTables("表B").addnew
                pr(
"客户代号") = dr("客户代号")
                pr("客户图号") = dr("客户图号")
            End
 
If
        
End If
End
 Select

--  作者:cd_tdh
--  发布时间:2024/5/14 16:54:00
--  
http://www.foxtable.com/webhelp/topics/1451.htm