Dim d1 As Date = e.Form.Controls("H").Value
Dim d2 As Date = e.Form.Controls("I").Value
Dim s As String = e.Form.Controls("J").Value
Dim b As New GroupTableBuilder("统计表1",DataTables("生产记录"))
If d1 = Nothing Or d2 = Nothing Then
MessageBox.Show("日期都不能为空","友情提醒",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Else
With DataTables("生产记录")
.LoadFilter = "日期>=#" & d1 & "# and 日期<=#" & d2 & "# and 配方名称 like '%" & s & "%'"
b.Groups.AddDef("配方名称")
b.Totals.AddDef("设定值")
b.Totals.AddDef("实际值")
b.Totals.AddDef("误差值")
b.Build '生成统计表
MainTable = Tables("统计表1")
.Load()
End With
End If
Dim d3 As Date = e.Form.Controls("H").Value
Dim d4 As Date = e.Form.Controls("I").Value
Dim s1 As String = e.Form.Controls("J").Value
Dim c As New GroupTableBuilder("统计表1",DataTables("生产记录"))
c.Filter = "日期>=#" & d3 & "# and 日期<=#" & d4 & "# and 配方名称 like '%" & s1 & "%'"
c.Groups.AddDef("配方名称")
c.Totals.AddDef("设定值")
c.Totals.AddDef("实际值")
c.Totals.AddDef("误差值")
c.Build '生成统计表
MainTable = Tables("统计表1")
Tables("主控窗口_Table2").DataSource = c.BuildDataSource()