以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]核实表存在的重复内容  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=63396)

--  作者:wumingrong1
--  发布时间:2015/1/20 11:25:00
--  [求助]核实表存在的重复内容
我的表中有十多万条记录,现在需要对这些记录进行多条件核实重复内容;比如:筛选出“表A”中的‘第一列’‘第二列’‘第三列’内容相同的行,命令该怎么写?或者是将有重复的行标上颜色也可以

Tables("A").RepeatFilter("第一列", 0)

[此贴子已经被作者于2015-1-20 11:27:33编辑过]

--  作者:有点甜
--  发布时间:2015/1/20 11:34:00
--  
Dim idxs As String = ""
For Each dr As DataRow In DataTables("表A").DataRows
    Dim dr2 As DataRow = DataTables("表A").Find("第一列=\'" & dr("第一列") & "\' and 第二列=\'" & dr("第二列") & "\' and _Identify <> " & dr("_Identify"))
    If dr2 IsNot Nothing Then
        idxs &= dr("_Identify") & ","
    End If
Next
Tables("表A").Filter = "_Identify in (" & idxs.trim(",") & ")"

--  作者:有点甜
--  发布时间:2015/1/20 11:37:00
--  

 或者参考这段

 

http://foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=61292&skin=0

 


--  作者:wumingrong1
--  发布时间:2017/5/10 18:11:00
--  

我在【工单号】列的 列属性 中选择了 禁止重复= True  但是我在该列中重复输入以下内容不会提示重复

 

 

CMCC-HZ-TYGZ-20170502-00615-001-0012


--  作者:有点色
--  发布时间:2017/5/10 20:20:00
--  
以下是引用wumingrong1在2017/5/10 18:11:00的发言:

我在【工单号】列的 列属性 中选择了 禁止重复= True  但是我在该列中重复输入以下内容不会提示重复

 

 

CMCC-HZ-TYGZ-20170502-00615-001-0012

 

只有在你表格输入值的时候,才会检测。你用代码赋值时不会检测

 

换一种方式 http://www.foxtable.com/webhelp/scr/2481.htm

 


--  作者:wumingrong1
--  发布时间:2017/5/17 15:30:00
--  

由于我是多人同时录入数据,怕多人同时录入同一工单。为避免该问题;我需要进行核查是否重复时、是直接去数据库进行核查、而不是在已加载的数据中进行核查。我的命令该怎么修改。

 

If e.DataCol.Name = "工单号" Then
    Dim dr As DataRow
    dr = e.DataTable.Find("工单号 = \'" & e.NewValue & "\'")
    If dr IsNot Nothing Then
        MessageBox.Show("此工单号已经存在!!!")
        e.Cancel = True
    End If
End If


--  作者:有点色
--  发布时间:2017/5/17 15:32:00
--  

If e.DataCol.Name = "工单号" Then
    Dim dr As DataRow
    dr = e.DataTable.SqlFind("工单号 = \'" & e.NewValue & "\'")
    If dr IsNot Nothing Then
        MessageBox.Show("此工单号已经存在!!!")
        e.Cancel = True

    Else

        e.datarow.Save
    End If
End If


--  作者:wumingrong1
--  发布时间:2017/6/12 10:52:00
--  

我想实现在当前表中,不允许同一个【工作站】有多个【职务】为“工作站站长”存在;以下命令该怎么改?

 

If e.DataCol.Name = "工作站"  Or e.DataCol.Name = "职务"  Then
    Dim dr As DataRow
    dr = e.DataTable.Find("工作站 = \'" & e.NewValue & "\' and 职务 = \'工作站站长\' ")
    If dr IsNot Nothing Then
        MessageBox.Show("该工作站已经存在站长,不能重复录入!!!")
        e.Cancel = True
    End If
End If


--  作者:有点色
--  发布时间:2017/6/12 10:59:00
--  

If e.DataCol.Name = "工作站"  Or e.DataCol.Name = "职务"  Then
    Dim dr As DataRow 

    If e.DataCol.Name = "工作站" then
        dr = e.DataTable.Find("工作站 = \'" & e.NewValue & "\' and 职务 = \'工作站站长\' ")

    ElseIf e.newvalue = "工作站站长"

        dr = e.DataTable.Find("工作站 = \'" & e.datarow("工作站") & "\' and 职务 = \'工作站站长\' ")

    End If


    If dr IsNot Nothing Then
        MessageBox.Show("该工作站已经存在站长,不能重复录入!!!")
        e.Cancel = True
    End If
End If


--  作者:wumingrong1
--  发布时间:2017/6/13 14:49:00
--  
还是不行、只要修改的是【工作站】内容、不管【职务】是什么,只要表中有相同内容都会弹出重复提示