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 GroupTableBuilder("统计表1", DataTables("订单加工")) g.Groups.AddDef("品种") g.Totals.AddDef("加工数", AggregateEnum.Count) g.Filter = Filter g.Build() MainTable = Tables("统计表1")
|