Dim Filter As String
With e.Form.Controls("A")
If .Value IsNot Nothing Then
Filter = "配方名称 = '" & .Value & "'"
End If
End With
With e.Form.Controls("B")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("C")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
Dim b As New GroupTableBuilder("统计表1",DataTables("生产记录"))
b.Groups.AddDef("原料名称") '根据产品分组
b.Totals.AddDef("设定值") '对数量进行统计
b.Totals.AddDef("实际值")
b.Totals.AddDef("误差值")
b.Build '生成统计表
MainTable = Tables("统计表1")
If Filter > "" Then
Tables("生产记录").Filter = Filter
End If