Query using And/Or variable from form

Steve400

Registered User.
Local time
Tomorrow, 05:07
Joined
May 1, 2013
Messages
33
I have a search form where users select criteria, which runs the query. e.g. Will return results of location 1 and location 2.
I want to make the And a variable so that the query can search either the above or location 1 OR location 2.

I have tried replacing the And in the query with the from control but Access doesn't like it. Can this be down any other way?

Select....
From....
WHERE (((forms!ServicesCombinedSearch!Location1)=services.location Or (forms!ServicesCombinedSearch!Location1) Is Null)

iif((forms!ServicesCombinedSearch!AndOr1)="Or","OR","AND")

((forms!ServicesCombinedSearch!Location2)=services1.location Or (forms!ServicesCombinedSearch!Location2) Is Null))
 
OK, thanks Pat,
I got around it using 2 queries, 1 for "and" and 1 for "or".
And a dropdown to select and link to desired query.
 

Users who are viewing this thread

Back
Top Bottom