老师:你好!
怎样实现 统计选择日期前的最后一行数据?
Dim dtb As New
DataTableBuilder("统计")
dtb.AddDef("日期", Gettype(data))
dtb.AddDef("产品", Gettype(String), 32)
dtb.AddDef("数量", Gettype(Integer))
dtb.AddDef("金额", Gettype(Double))
dtb.Build()
Dim QueryMonth As Date '自定义日期
QueryMonth = Forms("统计").Controls("日期").value
For Each nm As String In DataTables("订单").GetValues("产品")
Dim dr As
DataRow = DataTables("统计").AddNew()
dr("日期") = QueryMonth
dr("产品") = nm
dr("数量") = DataTables("订单").Compute("Sum(数量)","[产品] = '" & dr("产品") & "' and and [日期] < '" & QueryMonth") & "'") '这里怎样把选择日期前的最后一行条件加上
dr("金额") = DataTables("订单").Compute("Sum(金额)","[产品] =
'" & dr("产品") & "' and and [日期] < '" & QueryMonth") & "'") '这里怎样把选择日期前的最后一行条件加上
Next