Dim d1 As Date = e.Form.Controls("统计_StartDate").Value
Dim d2 As Date = e.Form.Controls("统计_EndDate").Value
Dim g As New GroupTableBuilder("年统计", DataTables("登记表"))
g.Filter = "业务日期>=#" & d1 & "# and 业务日期<=#" & d2 & "#"
g.Groups.AddDef("业务员")
g.Totals.AddDef("流入金额")
g.Totals.AddDef("流出金额")
g.VerticalTotal = True
g.SubTotal = True
g.Decimals = 2
g.FromServer = True
g.Build()
Tables("业务管理_统计报表").DataSource = g.BuildDataSource()
e.Form.Controls("统计报表").Visible = True
If d1 = Nothing Or d2 = Nothing Then
MessageBox.Show("起始或结束日期都不能为空!","友情提醒",MessageBoxButtons.OK,MessageBoxIcon.Warning)
End If
后来摸索了下,用上述代码可以实现,同时窗口提醒没有日期时不能进行统计