Dim b As New GroupTableBuilder("统计表1",DataTables("订单登记明细"))
'Dim Filter As String = "[交货日期] >= #" & StartDate & "# And [交货日期]<=#" & EndDate & "#"
Dim Filter As String
With e.Form.Controls("cmbProduct")
If .Value IsNot Nothing Then
b.Filter = "产品名称 = '" & .Value & "'"
End If
End With
With e.Form.Controls("cmbCustomer")
If .Value IsNot Nothing Then
If Filter > "" Then
b.Filter = Filter & " And "
End If
b.Filter = Filter & "客户 = '" & .Value & "'"
End If
End With
With e.Form.Controls("cmbEmployee")
If .Value IsNot Nothing Then
If Filter >"" Then
b.Filter = Filter & " And "
End If
b.Filter = Filter & "业务员 = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
b.Filter = Filter & " And "
End If
Filter = Filter & "交货日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter >"" Then
b.Filter = Filter & " And "
End If
b.Filter = Filter & "交货日期 <= #" & .Value & "#"
End If
End With
b.Totals.AddDef("数量","订购数量") '添加数量列用于统计
b.Totals.AddDef("金额","订购金额") '添加数量列用于统计
Tables("订单登记统计_Table2").DataSource = b.BuildDataSource()
一样不能执行。