表达式如下:
Dim Filter As
String
With e.Form.Controls("StartDate")
If .Value IsNot Nothing
Then
If Filter >"" Then
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
Filter = Filter & " And "
End
If
Filter = Filter & "日期 <= #" & .Value & "#"
End
If
End
With
If Filter > "" Then
Tables("订单").Filter = Filter & “ And 固定条件”
else
Tables("订单").Filter = "固定条件”
End
If
Dim g As New CrossTableBuilder("统计表1", DataTables("2012年数据"))
g.Filter = Filter & “ And 固定条件”
g.Caption = "下属企业经营情况"
g.HGroups.AddDef("下属企业")
g.VGroups.AddDef("经营范围")
g.Totals.AddDef("项目编号", AggregateEnum.Count, "项目编号")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Build()
MainTable = Tables("统计表1")
输入查询日期就不会错,不输入日期查询就会错
此主题相关图片如下:dsfbg.jpg