-- [求助]查询代码如何组合查询?
查询代码如何组合查询?当选一个选项时,可以查询,但同时选择多个条件时,无法查询,如何解决?代码如下:Dim Filter As String
With e.Form.Controls("comboBox1")
If .Value IsNot Nothing Then
Filter = "批次 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("comboBox15")
If .Value IsNot Nothing Then
Filter = "年度 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("comboBox16")
If .Value IsNot Nothing Then
Filter = "姓名 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("comboBox01")
If .Value IsNot Nothing Then
Filter = "鉴定类别 = \'" & .Value & "\'"
End If
End With
If e.Form.Controls("yjd").Checked = True \' 如果付款状态选择了"已付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "是否鉴定 = true"
End If
If e.Form.Controls("wjd").Checked = True \' 如果付款状态选择了"未付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "是否鉴定 = false"
End If
\'If Filter > "" Then
\'Tables("劳动能力鉴定_鉴定").Filter = Filter
\'End If
\'
If Filter > "" Then
Dim str As String = Tables("劳动能力鉴定_鉴定").DataTable.GetComboListString("_Identify", filter)
Tables("劳动能力鉴定_鉴定").Filter = "_Identify in (" & str.replace("|", ",") & ")"
End If
\'Tables("劳动能力鉴定_鉴定").Sort = "编号"