Okay, response time since it didn't show up. Double posting... I have a forum with four fields, three text areas, and a check box.
Say if I wanted to find a person from school "X", with Certification "Y", and teaching area "Z". That query would return results for printing.
From here, I want to not only display the previous selected people, I want to see if there have other certifications along side the previously selected area.
To do so, I created a sub query:
Code:
(SELECT [PersonID] FROM [PersonCert]
WHERE [PersonCert].[Name]
LIKE [Forms]![Find Sub]![Cert].[Value] & "*")
Which works. But, what I really want it to do is only display those results based on if that check box is true.
So, I put the statement in a IIF statement and then placed it in the field and ran the test to see if it worked:
Code:
(IIf([Forms]![Find Sub]![AllCert].[Value]=-1,([Person Table].[Person_ID]) In (SELECT [PersonID] FROM [PersonCert]
WHERE [PersonCert].[Name]
LIKE [Forms]![Find Sub]![Cert].[Value] & "*"),' '))
Returns that it's too complicated.
Here's the overall query:
Code:
SELECT DISTINCTROW [Person Table].[FirstName] & " " & [Person Table].[LastName] AS FullName, [Site Table].Name, PersonCert.Name, SubPosition.SkillLevel, Positions.Name, PersonCert.ExpirationDate, [Person Table].Phone, [Site Table].Phone, [Person Table].Person_ID
FROM [Site Table] INNER JOIN (Positions INNER JOIN (((PersonCert INNER JOIN [Person Table] ON PersonCert.PersonID = [Person Table].[Person_ID]) INNER JOIN SubPosition ON [Person Table].Person_ID = SubPosition.[SubstituteID]) INNER JOIN SubSite ON [Person Table].[Person_ID] = SubSite.[SubstituteID]) ON Positions.[Position_ID] = SubPosition.[Position_ID]) ON [Site Table].[Site_ID] = SubSite.[SiteID]
WHERE ((([Site Table].Name) Like [Forms]![Find Sub]![SiteName].[Value] & "*") AND ((PersonCert.Name) Like [Forms]![Find Sub]![Cert].[Value] & "*") AND ((Positions.Name) Like [Forms]![Find Sub]![JobTitle].[Value] & "*") AND ((Positions.Inactive)=False)) OR ((([Site Table].Name) Like [Forms]![Find Sub]![SiteName].[Value] & "*") AND ((Positions.Name) Like [Forms]![Find Sub]![JobTitle].[Value] & "*") AND (([Person Table].Person_ID)=(IIf([Forms]![Find Sub]![AllCert].[Value]=-1,([Person Table].[Person_ID]) In (SELECT [PersonID] FROM [PersonCert]
WHERE [PersonCert].[Name]
LIKE [Forms]![Find Sub]![Cert].[Value] & "*"),' '))) AND ((Positions.Inactive)=False));