DCount Multiple Condition Not Working

Ashfaque

Search Beautiful Girls from your town for night
Local time
Today, 20:27
Joined
Sep 6, 2004
Messages
897
Hi

Code:
Me.TextInspExpats = DCount("CDept", "T_JobOffer", "CNationality <> 'Irish' AND [CLastWorkingDate] Is Null  AND [CNo] <> Null AND [CDept]='Inspection' AND [CCrNumber]= 2051223412")

No error in above code and all conditions are working exept the last condition [CCrNumber]= 2051223412...

Could some look at this please.

Thanks,
 
Code:
Me.TextInspExpats = DCount("CDept", "T_JobOffer", "CNationality <> 'Irish' AND IsNull([CLastWorkingDate]) = True AND IsNull([CNo]) = False AND [CDept]='Inspection' AND [CCrNumber]= 2051223412")
 
One more thing --- CNationality <> 'Irish' will not select any rows where CNationality is null if you have that situation.

When you select "=", you don't have to worry about null but when you select "<>" you do have to consider whether you want to include null in the result set.
 
Code:
Me.TextInspExpats = DCount("CDept", "T_JobOffer", "CNationality <> 'Irish' AND IsNull([CLastWorkingDate]) = True AND IsNull([CNo]) = False AND [CDept]='Inspection' AND [CCrNumber]= 2051223412")
Thanks Arnel for your usual support.
 
One more thing --- CNationality <> 'Irish' will not select any rows where CNationality is null if you have that situation.

When you select "=", you don't have to worry about null but when you select "<>" you do have to consider whether you want to include null in the result set.
Absolutely correct...Thank you Pat..
 
You're welcome. This is such a fine point that many people don't even realize the problem until they run into a situation where they wanted a null value to be <> "something" and it isn't.
 

Users who are viewing this thread

Back
Top Bottom