以文本方式查看主题

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

--  作者:wangyinming
--  发布时间:2015/3/20 16:13:00
--  [求助] 自动输入

在表A中输入型号和工序(摆放、收取),在表B中查找相应

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.table

型号,对应的工序数值,然后显示在表A能力列中,请大家指教!!!!

 


图片点击可在新窗口打开查看此主题相关图片如下:捕获.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:捕获1.png
图片点击可在新窗口打开查看

--  作者:Bin
--  发布时间:2015/3/20 16:16:00
--  
http://www.foxtable.com/help/topics/1451.htm
--  作者:wangyinming
--  发布时间:2015/3/20 16:23:00
--  

但是我要加条件的啊,表A“收取”列=ture的时候,能力=表B中收“取列”的数据。和跨表应用有点区别啊,列名不一杨????


--  作者:Bin
--  发布时间:2015/3/20 16:25:00
--  
无非是条件多加一个 and  收取=True 而已
--  作者:有点甜
--  发布时间:2015/3/20 16:29:00
--  

datacolchanged事件

 

Dim cs() As String = {"收取", "摆放"}

If array.IndexOf(cs, e.DataCol.Name) > -1 Then
    If e.NewValue = True Then
        Dim fdr As DataRow = DataTables("表B").Find("型号 = \'" & e.DataRow("型号") & "\'")
        If fdr IsNot Nothing Then
            e.DataRow("能力") = fdr(e.DataCol.Name)
        Else
            e.DataRow("能力") = Nothing
        End If
    Else
        Dim cname As String = ""
        For Each c As String In cs
            If e.DataRow(c) = True Then
                cname = c
                Exit For
            End If
        Next
        If cname = "" Then
            e.DataRow("能力") = Nothing
        Else
            Dim fdr As DataRow = DataTables("表B").Find("型号 = \'" & e.DataRow("型号") & "\'")
            If fdr IsNot Nothing Then
                e.DataRow("能力") = fdr(cname)
            Else
                e.DataRow("能力") = Nothing
            End If
        End If
       
    End If
Else If e.DataCol.Name = "型号" Then
    Dim cname As String = ""
    For Each c As String In cs
        If e.DataRow(c) = True Then
            cname = c
            Exit For
        End If
    Next
    If cname = "" Then
        e.DataRow("能力") = Nothing
    Else
        Dim fdr As DataRow = DataTables("表B").Find("型号 = \'" & e.DataRow("型号") & "\'")
        If fdr IsNot Nothing Then
            e.DataRow("能力") = fdr(cname)
        Else
            e.DataRow("能力") = Nothing
        End If
    End If
End If