List Box

Results 1 to 2 of 2

Thread: List Box

  1. #1
    Jason Guest

    Default List Box

    I&#039m using a list box to all the user to select multiple values. The problem is when I submit, the values are separated by a coma, such as "value1, value2",<BR>I need to separate the values so I can use them into a select statement "where this=&#039value1&#039 and this=&#039value2&#039".<BR><BR>Any suggestions?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: List Box

    This should work...<BR><BR>theValues = Split(Request("fieldname"), ", ")<BR><BR>For x = 0 To UBound(theValues)<BR>If x = 0 Then<BR>strSQL = strSQL & "WHERE this = &#039" & thevalues(x) & "&#039 "<BR>Else<BR>strSQL = strSQL & "OR this = &#039" & thevalues(x) & "&#039 "<BR>End If<BR>Next<BR><BR>P.S. I think you want OR instead of AND. I don&#039t think a record could meet more than one condition in the same field.<BR><BR>HTH<BR><BR>Jerry

Posting Permissions

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