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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Expressions to find different records within one query...help

Status
Not open for further replies.

allcarfan

Programmer
Jan 29, 2003
33
0
0
US
I am trying to create a query that pulls back data if it meets 1 of 4 different criteria. I tried putting in 4 different expressions, but it didnt work. If I put in only 1 criteria, it pulls back the records that were specified, no problem. Like I said though, I need it to pull back records that many any of the 4 criteria/expressions that I state.

A little background - Date of Action and Sent to Field are date fields. If any of these four expressions are met and the result is less than the current date, then the results should be displayed. I put each one of these expressions in the query as expr1, expr2, etc...each with criteria of <Date()...the query only liked it when I had one or the other or the other or the other :)


Here are the 4 expressions - maybe I can put them all into one??

(IIf([Category I]=True And [Main Tracking Table]![Date of Action] Is Null,[Sent to Field]+20))

(IIf([Category I]=False And [Main Tracking Table]![Date of Action] Is Null,[Sent to Field]+30))

(IIf([Category I]=True And [Main Tracking Table]![Date of Action] Is Not Null,[Sent to Field]+20))

(IIf([Category I]=False And [Main Tracking Table]![Date of Action] Is Null,[Sent to Field]+30))

Any light you can shed would be great. Please try to keep things in lamens terms for me.

Shane
 
Hi,

Your logic is incorrect either way.
Code:
 (IIf([Category I]=True And [Main Tracking Table]![Date of Action] Is Null,[Sent to Field]+20))

 (IIf([Category I]=True And [Main Tracking Table]![Date of Action] Is Not Null,[Sent to Field]+20))
Whether the above Date of Action criterias are null or not - they still use [Sent to Field] + 20.

Same for the other 2 criterias.

What you need is:

(IIf([Category I]=True, [Sent to Field] + 20)))
(IIf([Category I]=False, [Sent to Field] + 30)))

Regards,

Darrylle

&quot;Never argue with an idiot, he'll bring you down to his level - then beat you with experience.&quot; darrylles@totalise.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top