Hello :-)
This query1 works flawlessly in the query builder, it returns all the right results regardless of the criteria i throw at it..(gender = 'male' AND age >20 AND assigned= 'yes'). the problem arises on form1.
i use qeury1 as form1's recordsource and display the results in datasheet mode. i enter my search criteria in form1's filter, but when i search for assigned= 'yes' AND *insert any other criteria here* , for example, assigned = 'yes' AND gender = 'male' it returns the right records but the assigned field displays 'no'.
QEURY1 is based on the volunteers table, it has all the fields from the volunteers, some calculated fields and one field called "assigned"..
assigned:IIF(Exists(SELECT Assignments.fkVolunteerID FROM Assignments WHERE (((Assignments.StartDate) Is Not Null) AND ((Assignments.EndDate) Is Null)) AND (Assignments.fkVolunteerID = Volunteers.pkVolunteerID)),"yes","no")
Form1 has its RECORDSOURCE set to "Query1" and its FILTER set dynamically to whatever the user wants to search by.
So for example.
(gender = male)
or
(gender = male) and (age >18)
or
(schoolname like '*harvard*')
or
(assigned= 'no') and (school is not null)
or
(assigned= 'no')
again, the problem arises when, the form filter includes "assigned= 'yes'" combined with any other criteria, the form returns the correct records but sometimes the assigned field says "no" when it should say yes. For example;
(assigned= "yes") AND (age > 30)
will show correctly all volunteers over age 30 who are assigned, but the assigned field will still say "no" even though these volunteers are clearly assigned = "yes".
another example,(assigned= "yes") and (schoolname is not null) and (gender = male) again, it will return the right records, but the assigned field will still say "no".
if i simply search for, Schoolname is not null , the assigned field displays correctly. If i search for gender = male and
age = 30 and schoolname is not null, the assigned field displays correctly.
Any advice would be appreciate.
Best Wishes,
WD
ps: after displaying the results of a filter with "assigned = 'yes'" and whatever, if i try to sort the datahseet by any column, database returns an error "query too complex".