Foxtable(狐表)用户栏目专家坐堂 → [求助]三个组合查重代码


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

主题:[求助]三个组合查重代码

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/10/15 11:37:00 [显示全部帖子]

代码改到DataColChanging事件

Select Case e.DataCol.name
    Case "仓库代码","物料编号","单位代码"
        Dim filter As String
        filter = "仓库代码" & IIF(e.DataRow.IsNull("仓库代码")," is null "," = '" & e.DataRow("仓库代码") & "'")
        filter &= "and 物料编号" & IIF(e.DataRow.IsNull("物料编号")," is null "," = '" & e.DataRow("物料编号") & "'")
        filter &= "and 单位代码" & IIF(e.DataRow.IsNull("单位代码")," is null "," = '" & e.DataRow("单位代码") & "'")
        If not filter.Contains("=") Then Return
        Dim dr As DataRow = e.DataRow
        If e.DataTable.Find(filter) IsNot Nothing Then
            MessageBox.Show("已经存在相同物料!","提示")
            e.Cancel = True
        End If
End Select

 回到顶部