以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  动态错误提示  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=137971)

--  作者:13775189031
--  发布时间:2019/7/19 13:49:00
--  动态错误提示
表1 :角钢发料明细  列“货位”
表2:货位名称  列“货位”
想实现在角钢发料明细中填写货位时,与表货位名称中的“货位”信息进行对比,若不同,则进行动态措施提示!
一下代码要怎么改?


If e.DataCol.name = "货位" Then
    If e.DataRow("货位")<> e.DataRow("货位") Then
        e.DataRow.SetError("货位", "与货位名称不符!")
    Else
        e.DataRow.SetError("货位","")
    End If
End If

--  作者:有点蓝
--  发布时间:2019/7/19 14:23:00
--  
使用find到其它表查询数据进行比较:http://www.foxtable.com/webhelp/topics/0396.htm
--  作者:13775189031
--  发布时间:2019/7/30 13:20:00
--  
动态错误提示:现在“货位”列设置了多值字段,如果单选没有问题,一旦多选,也会提示错误,怎么解决?
If e.DataCol.name = "货位" Then
    Dim dr7 As DataRow = DataTables("货位名称").Find("[货位] = \'" & e.DataRow("货位") & "\'")
    If dr7 Is Nothing Then
        e.DataRow.SetError("货位", "与货位名称不符!")
    Else
        e.DataRow.SetError("货位","")
    End If
End If



--  作者:有点蓝
--  发布时间:2019/7/30 14:33:00
--  
Dim dr7 As DataRow = DataTables("货位名称").Find("[货位] in (\'" & e.DataRow("货位").replace(",","\',\'") & "\')")