师傅你好:
统计的格式是对的,下列统计代码,是统计整张表的数量,对选取择日期统计,没有起作用:
Dim Filter As String
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
Filter = Filter & "出单日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "出单日期 <= #" & .Value & "#"
End If
End With
Dim g As New CrossTableBuilder("统计表1", DataTables("出口处理"), "[品种] is not Null ")
g.HGroups.AddDef("部门")
g.VGroups.AddDef("品种")
g.Totals.AddDef("订单数量", "订单数量")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Filter = "[品种] is not Null "
g.Build()
MainTable = Tables("统计表1")
还请师傅帮忙,谢谢!