Dim er As Row = Tables("表A").current Dim dr As DataRow = er.table.datatable.Find("[_SortKey] < " & er("_SortKey"), "[_SortKey] Desc") '找出上一行 If dr Is Nothing Then er("借贷方") = "贷" Else If er("余额") > dr("余额") er("借贷方") = "贷" Else er("借贷方") = "借" End If End If
If er("借贷方") = "贷" Then er("贷方金额") = er("交易金额") Else er("借方金额") = er("交易金额") End If