Okay, Select Case doesn't work like that.
You pass Null to the Select Case and the first condition it tries to match is an expression that calculates to either True or False. Cannot compare Null to anything because Null has nothing to compare.
If you pass a date such as 10/24/2021 to the Select, it won't match the InStr() >0 expression either because it also evaluates to True or False.
So EVERYTHING ends up in Else.
Use If Then ElseIf Else.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
WaitDate is variant input to a public function embedded in a query. I don't necessarily know if the table field is null or zero-length. I'm expecting the "IsNull(WaitDate)" to be either True or False. Are you telling me I can't test that way?
No, you can't. Imagine the test is
Any colour value will evaluate as that is the test. You cannot substitute other "things" like logical decisions, function tests, mismatched data types, etc. for what you're test is about (the Case statements).Code:Select Case colour Case "red" do something Case "blue" do this Case "green" do that Case Else do nothing End Select
You can test for null if that is the test. It might make more sense if I reverse the situation and say if you're testing for Null, why would you specify a Case for "red".
Perhaps make the test
Select Case Nz(WaitDate, 0)
Then the value evaluated by the Case statements will either be 0 or a valid date. With valid dates, you can do your tests and/or if 0 (not null) do whatever
Last edited by Micron; 10-24-2021 at 09:13 PM. Reason: correction
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
I see your point. Funny I've never had a "Select Mix" like this in the past. I'll recode appropriately.
Bill