老师:你好!
我需要对人员名册进行筛选统计。
1、登记日期 小于某个登记日期
2、离职日期 大于某个离职日期
3、离职日期 或者离职日期为空
下面代码中的离职日期为空如何修改?请帮助。
Dim Filter As String
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 & "离职日期 = ' Is null '" '离职日期为空
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
If Filter > "" Then
Tables("在职查询_Table1").Filter = Filter
End If