need help with IN statement

# Thread: need help with IN statement

1. Senior Member
Join Date
Dec 1969
Posts
104

## need help with IN statement

I need to write the following as shown below, the bracketed fields are 1 number per selected option from a drop down box and the = 4 should be the count of the searchable fields selected. Would someone be able to help me write it? thanks so much.<BR><BR>IN (352,188,189,181))) = 4)<BR><BR><BR>

2. Senior Member
Join Date
Dec 1969
Posts
7,686

## RE: need help with IN statement

I don&#039;t know what you mean by &#039;count of searchable fields&#039;, please explain.<BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
104

## RE: need help with IN statement

Hiya<BR><BR>Sorry, what I mean is that the number after the = needs to be how ever many fields you selected from the drop down box..ie<BR><BR>IN (352,188,189,181))) = 4)<BR>and<BR>IN (352,188,189))) = 3)<BR><BR>The first one has 4 options (the four numbers seperated by &#039;,&#039; so it is = &#039;4&#039;)<BR><BR>The second one has only 3 options selected so its = 3.<BR><BR>Sorry hope that makes it clearer..thanks very much for having a look.

4. Senior Member
Join Date
Dec 1969
Posts
7,686

## RE: need help with IN statement

You get the number of items in the string with the following code:<BR><BR>Response.Write (UBOUND(Split("212,34,65,897",","))+1), or turned into a function:<BR><BR>Function GetCount(theString)<BR> GetCount = UBOUND(Split(theString,","))+1<BR>End Function<BR>

5. Senior Member
Join Date
Dec 1969
Posts
104

## RE: need help with IN statement

Thanks so much Dutch I will give that a go..<BR><BR>thanks,

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•