你这种,肯定要循环才行啊
For Each dr As DataRow In DataTables("购单").Select("") Dim filter As String = "[单号] >= " & dr("开始") & " And [单号] <= " & dr("结束") DataTables("寄件").replacefor("购单", True, filter) dr("已用") = DataTables("寄件").Compute("count(购单)", filter)Next