Dim filter As String
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
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 bd1 As New GroupTableBuilder("统计表1",DataTables("订单"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("客户编号")
bd1.Totals.AddDef("数量","总数量") '对数量进行统计
bd1.Totals.AddDef("金额","总")
bd1.Filter = filter
bd1.Totals.AddDef("金额",AggregateEnum.Min,"最小值")
dt1 = bd1.BuildDataSource()
Dim t As Table = Forms("窗口2").controls("Table1").Table
t.DataSource = dt1 '将统计结果绑定到Table