以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  两个表格对比,空的单元格要填上0,才能筛选出来  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=125084)

--  作者:szsmall
--  发布时间:2018/9/19 16:35:00
--  两个表格对比,空的单元格要填上0,才能筛选出来
两个表格做对比,Find来寻找,找到逻辑列就打勾。空的单元格一定要打上0,如果是空的,没数值,代码就没效果。有办法空单元格,逻辑列也能筛选出来嘛

-----

If e.DataCol.Name = "日期" Or e.DataCol.Name = "增" Or e.DataCol.Name = "减"

    Dim dr1 As DataRow

    dr1 = DataTables("借贷表").Find("[日期] = \'" & e.DataRow("日期") & "\' and [增] = \'" & e.DataRow("增") & "\' and [减] = \'" & e.DataRow("减") & "\'")

    If dr1 IsNot Nothing Then

        e.DataRow("表一") = True

    Else

        e.DataRow("表一") = False

    End If

End If

-----


此主题相关图片如下:foxtable1.png
按此在新窗口浏览图片
 下载信息  [文件大小:   下载次数: ]
点击浏览该文件:银行对账.table


[此贴子已经被作者于2018/9/19 16:36:05编辑过]

--  作者:有点甜
--  发布时间:2018/9/19 17:22:00
--  
If e.DataCol.Name = "日期" Or e.DataCol.Name = "增" Or e.DataCol.Name = "减"
    Dim dr1 As DataRow
    Dim filter As String = "[日期] = \'" & e.DataRow("日期") & "\'"
    If e.DataRow("增") = Nothing Then
        filter &= " and [增] is null"
    Else
        filter &= " and [增] = " & e.DataRow("增")
    End If
    If e.DataRow("减") = Nothing Then
        filter &= " and [减] is null"
    Else
        filter &= " and [减] = " & e.DataRow("减")
    End If
    dr1 = DataTables("借贷表").Find(filter)
    If dr1 IsNot Nothing Then
        e.DataRow("表一") = True
    Else
        e.DataRow("表一") = False
    End If
End If

--  作者:szsmall
--  发布时间:2018/9/20 14:35:00
--  
加了下面代码,直接把空单元格标记成零,方便以后做统计。谢谢版主回复


If e.DataRow("增") = Nothing Then
    e.DataRow("增")=0
End If

If e.DataRow("减") = Nothing Then
    e.DataRow("减")=0
End If