Found a link for building search criteria: http://www.mvps.org/access/queries/qry0001.htm
[Forms]![myForm]![myControl] OR [Forms]![myForm]![myControl] Is Null
Thought it would be easy.
In the ContactTitle and City columns, I put in the criteria:
forms!frmSearch!txtTitle or forms!frmSearch!txtTitle Is Null
forms!frmSearch!txtCity or forms!frmSearch!txtCity Is Null
But after the query is saved, Access changed the two columns into four columns and the criteria spanned four rows. (Please see jpg attached)
The SQL statement is difficult to read, with all the ANDs and ORs and brackets:
SELECT Clients.ContactTitle, Clients.City
FROM Clients
WHERE (((Clients.ContactTitle)=[forms]![frmSearch]![txtTitle]) AND ((Clients.City)=[forms]![frmSearch]![txtCity])) OR (((Clients.City)=[forms]![frmSearch]![txtCity]) AND (([forms]![frmSearch]![txtTitle]) Is Null)) OR (((Clients.ContactTitle)=[forms]![frmSearch]![txtTitle]) AND (([forms]![frmSearch]![txtCity]) Is Null)) OR ((([forms]![frmSearch]![txtTitle]) Is Null) AND (([forms]![frmSearch]![txtCity]) Is Null));
My questions are:
Why did Access change the criteria?
How do I add additional criteria after the query is saved?
Any help is greatly appreciated.
[Forms]![myForm]![myControl] OR [Forms]![myForm]![myControl] Is Null
Thought it would be easy.
In the ContactTitle and City columns, I put in the criteria:
forms!frmSearch!txtTitle or forms!frmSearch!txtTitle Is Null
forms!frmSearch!txtCity or forms!frmSearch!txtCity Is Null
But after the query is saved, Access changed the two columns into four columns and the criteria spanned four rows. (Please see jpg attached)
The SQL statement is difficult to read, with all the ANDs and ORs and brackets:
SELECT Clients.ContactTitle, Clients.City
FROM Clients
WHERE (((Clients.ContactTitle)=[forms]![frmSearch]![txtTitle]) AND ((Clients.City)=[forms]![frmSearch]![txtCity])) OR (((Clients.City)=[forms]![frmSearch]![txtCity]) AND (([forms]![frmSearch]![txtTitle]) Is Null)) OR (((Clients.ContactTitle)=[forms]![frmSearch]![txtTitle]) AND (([forms]![frmSearch]![txtCity]) Is Null)) OR ((([forms]![frmSearch]![txtTitle]) Is Null) AND (([forms]![frmSearch]![txtCity]) Is Null));
My questions are:
Why did Access change the criteria?
How do I add additional criteria after the query is saved?
Any help is greatly appreciated.