谢谢大红袍老师的赐教,我把DataColChanged事件代码改成按钮代码,前半段代码可以实现所需效果。那么后半段代码(代码屏蔽部分)有什么作用?如何将其改成按钮代码,还请大红袍老师指教,再次衷心感谢!!
For Each dr1 As DataRow In DataTables("表A").DataRows
Dim drs As List(of DataRow)
Dim Filter As String
Filter = "[_SortKey] >= " & dr1("_SortKey") & " And [产品编号] = '" & dr1("产品编号") & "'"
drs = DataTables("表A").Select(Filter)
For Each dr As DataRow In drs
Filter = "[_SortKey] <= " & dr("_SortKey") & " And [产品编号] = '" & dr("产品编号") & "'"
dr("产品累计2") = DataTables("表A").Compute("count(产品编号)",Filter)
Next
'If e.DataCol.Name = "产品编号" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
'Filter = "[_SortKey] > " & dr1("_SortKey") & " And [产品编号] = '" & e.OldValue & "'"
'drs = DataTables("表A").Select(Filter)
'For Each dr As DataRow In drs
'Filter = "[_SortKey] <= " & dr("_SortKey") & " And [产品编号] = '" & dr("产品编号") & "'"
'dr("产品累计2") = DataTables("表A").Compute("count(产品编号)",Filter)
'Next
'End If
Next
[此贴子已经被作者于2016/6/20 10:25:30编辑过]