View Full Version : How to prioritize selection criteria?


bimmer5
06-28-2008, 11:04 AM
I am working on a query where I have two selection criteria that affect each other. The first one (field: "accnum") excludes all string values that begin with the "US" while the second one (field: "desc") keeps all values that contain string "MONTHLY". I need to tell Access to "force" the first criteria before applying the second one (heh, but I don't know how).

In the sample attached, please note that there are 3 entries that couldn't be removed from the list:
date accnum amount desc
05/30/08 US-F15 -1500 GJ009642 MONTHLY MANUAL US PROGRAM ACCRUAL - MAY 2
05/30/08 US-F15 -625 GJ009642 MONTHLY MANUAL US PROGRAM ACCRUAL - MAY 2
03/31/08 US-F15 -2125 GJ009439 MONTHLY MANUAL ACCRUALS - MARCH 2008 - US

Is there any way to resolve this?
Thank you for any suggestions.
Peter

Brianwarnock
06-28-2008, 11:27 AM
You never mentioned Invoice I had to delete my 1st reply after I decided to check your sample , why waste peoples time with an incomplete story.
You also need to put <>"US" on the second criteria row

Brian

bimmer5
06-28-2008, 12:21 PM
Putting the second <>"US" worked well.
Thank you very much, Mr. Brianwarnock for your effort in helping me. As well, sorry about not being clear at the first place.
Peter

Brianwarnock
06-29-2008, 04:18 AM
Ok Peter,
for your Info if you were writing the SQL you would write
WHERE (Mid([CDN]![accnum],1,2)<>"US" ) AND ((Mid([CDN]![desc],1,4)="Invo") OR (Mid([CDN]![desc],10,7)="MONTHLY"));
but you must make sure that the ( ) is correct.

but doing it via the design grid you always end up with the construct

(<>"US" and ="INVO") OR (<>"US" and ="MONTHLY")

both work but I guess that the first was what you were thinking of.

Brian

bimmer5
06-29-2008, 04:23 AM
I work in both of them, depending of complexity. You are right; both statements are correct and work for me!
All the best to you!