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!

'Included in' vs '=' in report where condition 3

Status
Not open for further replies.

foxrainer

Programmer
Jan 10, 2002
270
0
0
US
Hi all,

I have a report which prints the contents of stock items in certain areas, such as:

Room #1
Room #1-Cabinet #1
Room #1-Cabinet #2
etc. etc.

If I construct a where condition such as "Stock_Location = Room #1" then only items specifically labelled Room #1 will be found.

I would like a choice of whether the report looks specifically or inclusively, i.e.:

Choice 1: Find only items specifically in Room #1
Choice 2: Find any item which contains location Room #1

Somewhat of a wordy question, sorry,

Thanks in advance

Rainer
 
Try using:- (Stock_Location Like "Room #1*")

Hope this works.

Peace,

me2you
 
The In operator is basically a replacement for Or. The ideal operator in this case would have been the Like operator. You can use it to search partial strings. However, in this case the Like operator would not work because # is a wildcard for Like and therefore can not be part of the search string.

To find all the Room #1 items you would probably have to do something on the order of:

WHERE Left(Stock_Location,7)='Room #1'

This of course would have to be modified for the length of the string you are searching for and would only work for items beginning with the search string.

Hope this helps.

OnTheFly
 
the Like operator would not work because # is a wildcard for Like and therefore can not be part of the search string
I disagree. Simply use [#] in your pattern.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank you all for your qick and appropriate responses:

I ended up using '#'.

Again,

Thank you very much all of you,

Rainer
 
Thanks PHV, I did not know you could use [#] and have it work. That will come in handy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top