Dim Filter As String
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
Filter = "造林年度= '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "乡名= '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox3")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "村名 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox4")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "造林类别 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox5")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "林种 = '" & .Value & "'"
End If
End With
'messagebox.show(Filter)
if Filter = "" then
Dim g As New GroupTableBuilder("统计表2", DataTables("总览"))
g.Groups.AddDef("乡名")
g.Groups.AddDef("村名")
g.Totals.AddDef("设计面积")
g.Build()
MainTable = Tables("统计表2")
ElseIf Filter.IndexOf("年度") <> -1 and Filter.IndexOf("乡名") = -1 then
Dim g As New GroupTableBuilder("统计表2", DataTables("总览"))
g.Groups.AddDef("乡名")
g.Totals.AddDef("设计面积")
g.Build()
MainTable = Tables("统计表2")
ElseIf Filter.IndexOf("年度") <> -1 and Filter.IndexOf("乡名") <> -1 then
Dim g As New GroupTableBuilder("统计表2", DataTables("总览"))
g.Groups.AddDef("村名")
g.Totals.AddDef("设计面积")
g.Build()
MainTable = Tables("统计表2")
else
messagebox.show(".....")
end if
'messagebox.show(Filter.IndexOf("乡名"))