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