Dim a
Dim varItm
a = ""
For Each varItm In Me![ChooseName].ItemsSelected '以循环取得复选值
a = a & " or 产品名称 Like" & Chr(39) & _
Me![ChooseName].ItemData(varItm) & Chr(39) ''''''''''''''
Next varItm
If a <> "" Then '去除最左边的四个字符
a = "(" & Right(a, Len(a) - 4) & ") And "
End If
If IsNull(Me![StartDate]) = True And IsNull(Me![EndDate]) = False Then
a = a & "日期 <=#" & Me![EndDate] & "# "
ElseIf IsNull(Me![StartDate]) = False And IsNull(Me![EndDate]) = True Then
a = a & "日期 >=#" & Me![StartDate] & "#"
ElseIf IsNull(Me![StartDate]) = False And IsNull(Me![EndDate]) = False Then
a = a & "(日期 between #" & Me![StartDate] & _
"# and #" & Me![EndDate] & "#)"
ElseIf IsNull(Me![StartDate]) = True And IsNull(Me![EndDate]) = True Then
a = Left(a, Len(a) - 5)
End If
If ActMod <> "" Then
Me![SleData].Form.Filter = a And "&' 属性 = Me![ActMod]'"
Me![SleData].Form.FilterOn = True '执行筛选
Me![SleOk].Caption = "取消检索"
Me![SleOk].ForeColor = RGB(255, 0, 0)
End If
Me![SleData].Form.Filter = a '设定筛选条件
Me![SleData].Form.FilterOn = True '执行筛选
Me![SleOk].Caption = "取消检索"
Me![SleOk].ForeColor = RGB(255, 0, 0)