SQLFind查询的是已经保存的数据,如果没有保存,是查不到的
If e.DataCol.name = "系统主卡编号" Then
Dim dr1 As DataRow
Dim dr2 As DataRow
Dim mr As DataRow = e.DataRow
dr1 = DataTables("主卡余额汇总流水").find("[_sortkey] < " & mr("_sortkey") & " And [系统主卡编号] = '" & mr("系统主卡编号") & "'","[_sortkey] desc")
dr2 = DataTables("新增主卡明细").find("[系统主卡编号] = '" & mr("系统主卡编号") & "'")
If dr1 Is Nothing Then
If dr2 IsNot Nothing Then mr("期初余额") = dr2("期初余额")
Else
mr("期初余额") = dr1("主卡余额")
End If
End If