以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  符合多条件的自动制行代码  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=173081)

--  作者:爱相随
--  发布时间:2021/11/14 10:14:00
--  符合多条件的自动制行代码
老师,下面代码是表示在pjtzhzb表的同一行查找“出票人”列和“出票银行”列是否有与本表相同的值,如果没有找到,则将此值复制到pjtzhzb中,否则不复制。下面代码无法执行。
If e.DataCol.Name = "出票人" Then
    If e.NewValue IsNot Nothing AndAlso e.DataRow("出票银行") Is Nothing Then
        Dim dr As DataRow
        dr = DataTables("pjtzhzb").Find("出票人 = \'" & e.NewValue & "\'AND 出票银行 = \'" & e.NewValue & "\'")
        If dr Is Nothing
            dr = DataTables("pjtzhzb").addnew
            dr("出票人") = e.NewValue
            dr("出票银行") = e.NewValue
        End If
    End If
End If

--  作者:minxizai
--  发布时间:2021/11/14 12:12:00
--  

select case e.datacol.name
case "出piao人","出piao银行"
If e.NewValue IsNot Nothing AndAlso e.DataRow("出piao银行") Isnot Nothing Then
        Dim dr As DataRow
        dr = DataTables("pjtzhzb").Find("出piao人 = \'" & e.NewValue & "\'AND 出piao银行 = \'" & e.NewValue & "\'")
        If dr Is Nothing
            dr = DataTables("pjtzhzb").addnew
            dr("出piao人") = e.NewValue
            dr("出piao银行") = e.NewValue
        End If
    End If
end select

--  作者:有点蓝
--  发布时间:2021/11/14 20:54:00
--  
select case e.datacol.name
case "出piao人","出piao银行"
If e.DataRow.isnull("出piao人") = false AndAlso e.DataRow.isnull("出piao银行") =false Then
        Dim dr As DataRow
        dr = DataTables("pjtzhzb").Find("出piao人 = \'" & e.DataRow("出piao人") & "\' AND 出piao银行 = \'" & e.DataRow("出piao银行") & "\'")
        If dr Is Nothing
            dr = DataTables("pjtzhzb").addnew
            dr("出piao人") = e.NewValue
            dr("出piao银行") = e.NewValue
        End If
    End If
end select