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

"OR" condition in a query 2

Status
Not open for further replies.

JailGuardGuy

Technical User
Jul 12, 2005
4
US
I have a query that concatenates the name of a staff member with the results of either of two check boxes.
Check box [AOT] indicates that staff member [A] worked overtime. Check box [ATRD] indicates whether that staff member worked a trade for someone else.

The statement ([A]) & " " & (IIf([AOT]=0,"","O.T.")) worked just fine until someone decided we needed to indicate whether an employee traded a shift with someone else. I tried tieing them together with an "OR" statement but obviously, from my results, I don't understand how to do it properly because the output would be "-1" instead of something like "Roscoe Smedley, O.T." or "Roscoe Smedley, TRD"

What I tried:

Expr1: ([A]) & " " & (IIf([AOT]=0,"","O.T.")) OR ([A]) & " " & (IIf([ATRD]=0,"","TRD"))

Any help, even derisive and snide remarks, would be appreciated. :)
 
this maybe?:

([A] & " " & (iif([AOT] <> 0, "O.T.", iif([ATRD] <> 0, "TRD", "ERROR"))

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
LesPaul,

Soooooo close.... I had to close the parentheses around([A]) to stop the nag about it and then my results were good except for an "Error" next to an employee's name. I looked at the db and could see no overt anomaly with the record. Running out of time...will continue researching that tomorrow.

Thanks a million
 
Les,

You're probably getting a good chuckle out of this because you realize what is causing the word "Error" to show up whereas I had to think it through. Therein lies the difference between a pro like you and an amateur putz like me. [tongue]

Thanks again for your help.
 
I bet you found some records where neither of those conditions were true!!!

Glad to help & thanks for the star & the compliment! Have a great day!

leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top