Dim filter As String = "1=2" For Each bh As String In DataTables("表A").GetValues("编号") Dim count As Integer = DataTables("表A").Compute("count(_Identify)", "编号 = '" & val(bh) & "'") If count > 1 Then filter &= " or 编号 = '" & bh & "'" End If Next Tables("表A").filter = filter