以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  重复数据提醒  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=95535)

--  作者:wangnovel
--  发布时间:2017/1/22 22:00:00
--  重复数据提醒
表A
 ID   ZD1 
   1   q
   2   w
   3   e
   2   r
   3   t

如表AID有重复数据,我希望设计一个按钮,点击该按钮,能提醒用户:有ID为“2”“3”的数据重复


--  作者:有点色
--  发布时间:2017/1/22 22:50:00
--  

 你直接用命令更好吧?

 

http://www.foxtable.com/webhelp/scr/1478.htm

 

http://www.foxtable.com/webhelp/scr/2712.htm

 


--  作者:wangnovel
--  发布时间:2017/1/22 23:00:00
--  
@有点色,我也是想用repeatfilter,但具体如何使用,使得弹出的对话框中能够出现重复的字段的值。另外,repeatfilter的返回值是什么类型的?
--  作者:有点色
--  发布时间:2017/1/22 23:34:00
--  

参考代码

 

Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "第一列"
For Each dr As DataRow In DataTables("表A").Select("", cs)
    Dim flag As Boolean = False
    If pdr IsNot Nothing Then
        For Each c As String In cs.split(",")
            If pdr(c).replace(" ","") <> dr(c).replace(" ", "") Then
                flag = True
                Exit For
            End If
        Next
        If flag Then
            If count > 1 Then
                idx &= idx_temp
            End If
            count = 1
            idx_temp = ""
        Else
            count += 1
            idx_temp &= dr("_Identify") & ","
        End If
    Else
        count += 1
    End If
    pdr = dr
Next

If count > 1 Then
    idx &= idx_temp
End If

Tables("表A").filter = "_Identify In (" & idx.trim(",") & ")"
msgbox("_Identify In (" & idx.trim(",") & ")")