显示错误信息:“字符串未被识别为有效的 DateTime。有一个从索引 9 处开始的未知字”。
前面的筛选OK,时间不能运行
Dim Filter As String
With e.Form.Controls("产品")
If .Value IsNot Nothing Then
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("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "订单日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "订单日期 <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Tables("订单明细表").Filter = Filter
End If