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

Is this Paosible to Do in a Query??? 2

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
US
I have a select query in Access2000. In the query I have a WHERE clause. In the WHERE, I would like to know if this is posiable in Access. Here is the code:

WHERE (X Or Y Or Z) Then O+1

Is the O+1 something doable in Access? Is it something doable in a query? If not, could someone suggest a way of doing iit. Thanks alot to anyone answering this question.
 
I think it is possible, you should be able to create an additional field in the same query with calculation.
 
I really kind of got to know. If this is doable then I can finish my query, if not I got to start looking other places. Thanks for the quick response though.
 
If you mean can you use a criteria that means one thing if X, Y, or Z is true and something else if they are not, you can use the IIf function. WHERE IIf(X Or Y Or Z, O+1, falsepart)
 
I mean if either one of X, Y, or Z is true then O+1, add 1 to the variable O. Thanks you for the quick response, it sound like WHERE IIf may be the answer, if I am writing correctly.
 
IIf(X=True Or Y=True Or Z=True,O+1,0)
You don't need to use Where
 
Great, sound like what I am after. Could you do me one small favor, take a quick look at the thread "Problem Query Need Help". Wouldn't I use the same logic there? As soon as I finish than little query I am off to the testing track. Thanks alott for all of your help.
 
If the IIf is going in the criteria of the query grid, the WHERE will show up in the SQL of it's own accord. The way the question was phrased originally I thought that was where the query was being composed.
"add 1 to the variable O" confuses me, since criteria don't DO anything, they're just something to look for.
 
I was trying to find out if my other thread "Problem Query Need Help" was doable or not and by the looks of things it is. I have been hoping someone would look at it and give me a quick pointer on it. It has already driven me crazy getting it this far along. Thanks again for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top