这样也不行
Dim Filter As String
Dim Filter1 As String
Dim chk1 As WinForm.CheckBox = Forms("中兴明细").Controls("出仓")
With e.Form.Controls("型号")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "型号 = '" & .Value & "'"
End If
End With
With e.Form.Controls("规格")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "规格 = '" & .Value & "'"
End If
End With
With e.Form.Controls("颜色")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "颜色 = '" & .Value & "'"
End If
End With
With e.Form.Controls("开始日期")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("截止日期")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
With e.Form.Controls("月份")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "月份 = '" & .Value & "'"
End If
End With
Dim chk As WinForm.CheckBox = Forms("中兴明细").Controls("入仓")
With e.Form.Controls("入仓")
If chk.Checked = True Then
If Filter1 >"" Then
Filter = Filter1 & " And "
End If
Tables("中兴明细").Filter = "[入仓数量] Is Not Null"
End If
End With
With e.Form.Controls("出仓")
If chk1.Checked = True Then
If Filter1 >"" Then
Filter = Filter1 & " And "
End If
Tables("中兴明细").Filter = "[出仓数量] Is Not Null"
End If
End With
If Filter > "" Then
If Filter1 > "" Then
Tables("中兴明细").Filter = Filter1
End If
Tables("中兴明细").Filter = Filter
End If