Multiple condition search through one query?

Modesty_Blaze

Registered User.
Local time
Today, 19:08
Joined
Sep 25, 2003
Messages
10
Problem:

I can't make it work to search from one single search form to search on several fields to reduce number of results. I have over 1000 of records and you can search by name and code to get specific record. You can also search by angle Alfa and Beta, Graf type (left and right), etc.

If I make several queries to search per each category, I'll end up with quite a lot queries, and a lot of records as results of those queries. So, what I need is to be able to give several parameters for ONE search.

Now, individual searches work fine (in criteria for query I put: [Forms]![Pretraga]![AlphaLL]), but when I try to do it for more than one field (in alfa left I put [forms]![Pretraga]![AlphaLL], in betha Left [forms]![Pretraga]![BethaLL]), I never get any results. (Like I put only one parameter and leave other blank).

Question is where am I doing it wrong?

Another question is where can I find syntaxes for expresion builder, like for criteria that you can put in query?

Thanks in advance (gotta admit: I have learned so much since I joined AWF)
 
Addition to previous post

I have to simplify this!!!

I need someone to explain me how to exclude conditions that are left empty in that search form!!!

Sorry...
 
You need to organize your criteria into pairs -

If both FieldA and FieldB need to be true:
(FieldA = Forms!YourForm!FieldA OR Forms!YourForm!FieldA Is Null) AND (FieldB = Forms!YourForm!FieldB OR Forms!YourForm!FieldB Is Null)

If either FieldA or FieldB can be true:
(FieldA = Forms!YourForm!FieldA OR Forms!YourForm!FieldA Is Null) OR (FieldB = Forms!YourForm!FieldB OR Forms!YourForm!FieldB Is Null)

The parentheses are critical in the first criteria since it is combining AND and OR operators but optional in the second since only the OR operator is used.
 

Users who are viewing this thread

Back
Top Bottom