为什么查询的时候只取最后一个查询条件,不能联合查询呢?高手帮忙看看问题在什么地方,谢谢
此主题相关图片如下:qq图片20190602081104.png
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 = "考试年月= '" & .Value & "'"
End If
End With
With e.Form.Controls("combobox3")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
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 = "科类= '" & .Value & "'"
End If
End With
With e.Form.Controls("combobox5")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = "姓名= '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("成绩表").Filter = Filter
End If