Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using And & Or in QBE

Status
Not open for further replies.

LakotaMan

Instructor
Aug 21, 2001
240
US
I can't seem to get results from a keyword search on this, probably because of the redundancy of the operator words. My question is probably very simple, but, as always, any help and clarification is appreciated.

In the QBE when I use both the criteria line and the or line, how are the passes made through the data in the table? Does it look for the criteria first and then check the Or criteria, or does it analyze each parameter field by field, or what?

If I use more than criteria on either or both lines, how does that work?

I read an explanation once on how Access actually processes these requests, but have since lost the reference.

Again, thanks for your help,
Tru
 
Anyway, the query builder is often confused with multiples Or criterias.
I personally always take a look at the generated SQL instruction.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
hymn: I went to the link you provided and saw several topics on Access queries, but couldn't find one to answer this question. Did you find a particular one that you thought I should see? Sorry to be so obtuse. . .

PHV: So maybe I could generate a multiple criteria query using the QBE and then just look at the SQL Access generated? I do some SQL work on the application development side, so maybe this would make the process clearer to me.

Thanks to you both for your help,
Tru
 
If you set up the grid like this:


Field1 Field2 Field3
=Something =Nothing
=More
=OtherThing

the SQL produced will be:

FIELD1 = "Something" AND Field2 = "Nothing" OR Field2 = "More" OR Field3 = "OtherThing"

So, for each item that you put on the SAME line you will get AND, for each item you put on the NEXT line in the grid will give you OR.

Once you have created the query in the GRID you can switch to SQL view and see how moving things from one line to the other changes the ANDs and ORs.

I personally prefer writing the query in SQL and not using the grid at all.

HTH

leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top