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

Can a field be conditionally Displayed in a query ? 1

Status
Not open for further replies.

saustin

MIS
Feb 19, 2001
336
0
0
US
Hi,
Want the display of a field in a query to be conditional upon another field in the query having a certain value "S", "H", OR "V". Do not see where you can build something like =[nameofafield] if "SHV" in [fieldtobechecked] ? Has anyone tried this ?

Many thanks for any reply. Steve.
 
I think I did something like that by joining the same table twice in the query. The 2nd copy of the table was used to retrieve the field based on the condition in the other field. Another way I have done that sort of thing is to write one query and use it (as a table) in a 2nd query. It effectively creates a sub-select to get around ambiguous joins.

Frank
 
Thanks for the reply Frank. That is what I have always done too but was taking the extra time now to possibly learn a new trick to get around this. Thanks again, Steve.
 
Hi Steve,

I don't fully understand your question, but can you not do something like ..

[blue][tt]=IIF(InStr("S, H, V",[fieldtobechecked])=0,"",[fieldtodisplay])[/tt][/blue]

If [fieldtobechecked] can be null or zero length, you will need a slightly more complicated condition

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Hi Tony,
Geunius !!! Really Super ! [bigsmile] [bigsmile] [bigsmile] Thanks so VERY much. This worked perfectly. It is exactly the type of logic that will also save time in the future.

Best Regards, Steve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top