如图,筛选有二类条件,状态和分类
要示:
状态或者分类里面是复选是和的关系,
状态与分类之间是交叉的关系。
要求状态或者分类任何一类中,全选或全不选均是全选中的含义
请高手帮我检查下代码
-------------------------------------------
Tables("信息表").filter = ""
Dim hg As WinForm.CheckBox = e.Form.Controls("CheckBox1")
Dim ds As WinForm.CheckBox = e.Form.Controls("CheckBox2")
Dim yqx As WinForm.CheckBox = e.Form.Controls("CheckBox3")
Dim filter1 As String
If hg.Checked Then
If filter1 > "" Then
filter1 = filter1 & " Or "
End If
filter1 = filter1 & " 状态 = '合格' "
End If
If ds.Checked Then
If filter1 > "" Then
filter1 = filter1 & " Or "
End If
filter1 = filter1 & " 状态 = '待审' "
End If
If yqx.Checked Then
If filter1 > "" Then
filter1 = filter1 & " Or "
End If
filter1 = filter1 & " 状态 = '己取消'"
End If
If hg.Checked = False AndAlso ds.Checked = False AndAlso yqx.Checked = False Then
filter1 = filter1 & " 状态 = '合格' or 状态 = '待审' or 状态 = '己取消'"
End If
Dim gj As WinForm.CheckBox = e.Form.Controls("CheckBox4")
Dim yb As WinForm.CheckBox = e.Form.Controls("CheckBox5")
Dim filter2 As String
If ds.Checked Then
If filter2 > "" Then
filter2 = filter2 & " Or "
End If
filter2 = filter2 & " 分类 = '关键' "
End If
If yqx.Checked Then
If filter2 > "" Then
filter2 = filter2 & " Or "
End If
filter2 = filter2 & " 分类 = '一般'"
End If
If gj.Checked = False AndAlso yb.Checked = False Then
filter2 = filter2 & " 分类 = '关键' or 分类 = '一般' "
End If
If filter1 > "" Then
If filter2 > "" Then
filter1 = "(" & filter1 & ")" & " And " & "(" & filter2 & ")"
End If
Else
filter1 = filter2
End If
Tables("信息表").Filter =filter1 & " And " & filter2