流水账代码,在加上下面的代码就行了。
Dim max As Double = DataTables("表A").Compute("max(合格数量)", "附表编号列='" & e.DataRow("附表编号列") & "'")
For Each r As DataRow In DataTables("表A").Select("附表编号列='" & e.DataRow("附表编号列") & "'")
If r("未结数量")=0 Then
r("结账情况")="已结账"
ElseIf r("未结数量") < max AndAlso r("未结数量")> 0 Then
r("结账情况")="结账中"
ElseIf r("未结数量") = max Then
r("结账情况")="未结账"
End If
Next