Criteria Placement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am placing approx 10 expressions in my select query. I have noticed that
the results change depending on what line I place my criteria on. I never
noticed that before. I have not used Access sense 97 and I thought you could
put most of your criteria on te same line. Why and what type of problem would
this omit? Why do you have to put your criteria on different lines? such as..

criteria line 1 XXXXX.XXXX
or XXXXXXXXXX
or FFFFFFFFFFF
 
I am placing approx 10 expressions in my select query. I have noticed that
the results change depending on what line I place my criteria on. I never
noticed that before. I have not used Access sense 97 and I thought you could
put most of your criteria on te same line. Why and what type of problem would
this omit? Why do you have to put your criteria on different lines? such as..

criteria line 1 XXXXX.XXXX
or XXXXXXXXXX
or FFFFFFFFFFF

If you are using several different fields in you criteira, place the
criteria on the same line creates an AND criteria,
Where [FieldA] = "XYZ" AND [FieldB] = "ABC"

If you place the criteria on the next row down, it creates an OR
criteria:
Where [FieldA] = "XYZ" OR [FieldB] = "ABC"

If you place the criteria on the same row for several fields and the
next row down on another field, you get:

Where [FieldA] = "XYX" AND [FieldB] = "ABC" OR [FieldC] = "EFG"
 
troy said:
I am placing approx 10 expressions in my select query. I have noticed that
the results change depending on what line I place my criteria on. I never
noticed that before. I have not used Access sense 97 and I thought you could
put most of your criteria on te same line. Why and what type of problem would
this omit? Why do you have to put your criteria on different lines? such as..

criteria line 1 XXXXX.XXXX
or XXXXXXXXXX
or FFFFFFFFFFF

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The above would equal this in SQL WHERE clause:

WHERE column = XXXXX.XXXX OR column = XXXXXXXXXX OR column = FFFFFFFFFFF

Setting up the grid like the following:

Column colA colB colC
Criteria: XXXXX FFFFF ZZZZZ

would result in a WHERE clause like this:

WHERE colA = XXXXX AND colB = FFFFF AND colC = ZZZZZ

ORing means that if ANY of the values in the criteria are in the record
then select the record.

ANDing means that ALL of the values in the criteria have to be in the
record before it it selected.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRE+194echKqOuFEgEQLyvwCdHoTWzXhK6+pWsPlw7rX9MwcBicAAnREI
OKvHFhpzSfkbdAdkCdPgU+6G
=mJXL
-----END PGP SIGNATURE-----
 
Thank you got it!

fredg said:
I am placing approx 10 expressions in my select query. I have noticed that
the results change depending on what line I place my criteria on. I never
noticed that before. I have not used Access sense 97 and I thought you could
put most of your criteria on te same line. Why and what type of problem would
this omit? Why do you have to put your criteria on different lines? such as..

criteria line 1 XXXXX.XXXX
or XXXXXXXXXX
or FFFFFFFFFFF

If you are using several different fields in you criteira, place the
criteria on the same line creates an AND criteria,
Where [FieldA] = "XYZ" AND [FieldB] = "ABC"

If you place the criteria on the next row down, it creates an OR
criteria:
Where [FieldA] = "XYZ" OR [FieldB] = "ABC"

If you place the criteria on the same row for several fields and the
next row down on another field, you get:

Where [FieldA] = "XYX" AND [FieldB] = "ABC" OR [FieldC] = "EFG"
 
Great help thanks again!

fredg said:
I am placing approx 10 expressions in my select query. I have noticed that
the results change depending on what line I place my criteria on. I never
noticed that before. I have not used Access sense 97 and I thought you could
put most of your criteria on te same line. Why and what type of problem would
this omit? Why do you have to put your criteria on different lines? such as..

criteria line 1 XXXXX.XXXX
or XXXXXXXXXX
or FFFFFFFFFFF

If you are using several different fields in you criteira, place the
criteria on the same line creates an AND criteria,
Where [FieldA] = "XYZ" AND [FieldB] = "ABC"

If you place the criteria on the next row down, it creates an OR
criteria:
Where [FieldA] = "XYZ" OR [FieldB] = "ABC"

If you place the criteria on the same row for several fields and the
next row down on another field, you get:

Where [FieldA] = "XYX" AND [FieldB] = "ABC" OR [FieldC] = "EFG"
 
Thank you very much is was explained perfectly. I have one more question if
you would. I have say 10 fields with the same expression. How come when I
place them in different positions in the OR section I get different results
then say if I put them all on the same line of the OR section. To get my
results I have to drop down a line for each filed the the same thing goin
back up the section. Why is that?
 
It is OR between lines in the grid and AND within the line.

This allows you to say
field1 = "A" and Field2 = "B"
OR Field1="X" and Field3 = 22
OR Field1 = "C" and Field2 ="O"
 
Back
Top