OR rather than AND

potts

Registered User.
Local time
Today, 00:04
Joined
Jul 24, 2002
Messages
87
I'm building a multi criteria search form. All is well, but I now want to make one of the controls, one containing multiple selections, an OR rather than an AND variable.

Does anyone know how to do this?

Thanks
 
One way is to place "Or'ed" criteria on separate rows of the QBE frame.
 
I'm not sure I understand!
 
Create a table, tbCompanies, with one field, sCompany (Text 3), and then cut & paste the following in the SQL view of a query:

SELECT tbCompanies.sCompany
FROM tbCompanies
WHERE (((tbCompanies.sCompany)="ABC")) OR (((tbCompanies.sCompany)="XYZ"));

then display the query in the Design view. You'll see that the "ABC" and "XYZ" criteria are on separate rows of the QBE frame.
 
When you use both AND's and OR's in the same conditional statement or WHERE clause, you'll probably need to surround some part of the compound expression with parentheses to ensure that the condition is evaluated as you intend. An easier construct to use in your situation is IN(). So rather than building something that says:

fldX = "something" AND (fldA = "a" or fldA = "b" or fldA = "c" ...) AND flxz = "somethingelse"

use the following syntax:

fldX = "something" AND fldA In("a","b","c"...) AND fldZ = "somethingelse"
 

Users who are viewing this thread

Back
Top Bottom