楼主: 你的统计代码后加上:
For Each r As Row In Tables("还款统计").rows Dim Cns As List(Of String) Cns = DataTables("欠款明细表").GetUniqueValues("[记账单位] = '" & r("记账单位") & "' And [单据号] <> ''","单据号") r("总单据数") = Cns.countNext