Hi Amer,
You might want to verify that the Email field does not contain zero length
strings (ZLS), in place of null. Both situations would have the same visual
appearance. In table design view, does the Email field include a setting of
Yes for the "Allow Zero Length" property? To read more about this issue, see
this article:
Fields: Allow Zero Length
http://allenbrowne.com/bug-09.html
I can't say that I have ever seen the use of an IIF statement in the
criteria of a query. Perhaps this will work, but I just don't know for sure.
However, is there a reason that you cannot add this IIF statement instead to
the "qryEmployeesDetails" query? This should allow you to eliminate the
criteria in your existing query. Something like this, in the
"qryEmployeesDetails" query design view:
EMailAddy: IIF(IsNull(),[Contact.Email],[Email])
Then include the EMailAddy field in your new query.
Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
[QUOTE="Amer"]
Thank you for the tips.
Here's the SQL for you:
---------------------------------------------------------------------------------------
SELECT tabGroups.GroupRef, tabGroups.Rating, tabGroups.Part,
tabGroups.InstructionDays, tabGroups.OnHours, tabGroups.SessionDuration,
tabGroups.StartingDate, tabGrouping.FileNo, tabGrouping.EnglishName,
tabGrouping.ArabicName, qryEmployeesDetails.DepartmentName,
qryEmployeesDetails.CompanyName, qryEmployeesDetails.Email, Contact.Email
FROM ((tabGrouping INNER JOIN (tabGroups INNER JOIN tabApplications ON
tabGroups.CourseRef = tabApplications.CourseRef) ON (tabGroups.GroupRef =
tabGrouping.GroupRef) AND (tabGrouping.FileNo = tabApplications.FileNo))
INNER JOIN tabContactInfo AS Contact ON tabApplications.ApprovedBy =
Contact.FileNo) INNER JOIN qryEmployeesDetails ON tabGrouping.FileNo =
qryEmployeesDetails.FileNo
WHERE
(((qryEmployeesDetails.Email)=IIf(IsNull([qryEmployeesDetails.Email]),[Contact.Email],[qryEmployeesDetails.Email])));
--------------------------------------------------------------------------
Now after adding the criteria that checks of the email is null and replacing
that with another email, the query filters the data and shows only those
employees who have their own emails...![/QUOTE][/QUOTE]