Multiple option selects

Results 1 to 2 of 2

Thread: Multiple option selects

  1. #1
    Join Date
    Dec 1969
    Posts
    11

    Default Multiple option selects

    I need my users to be able to make multiple option selects from a list box, to search for database records e.g. if I have list box of countries they can pick &#039France&#039 and &#039Germany&#039 for example. I have the box working fine, but I can&#039t work out the SQL code on the receiving page to process both options. Can anyone help ? Thanks.

  2. #2
    Stephan Zutterman Guest

    Default RE: Multiple option selects

    Imagine the user selected France and Germany. The request variable (CountryField) contains then &#039France, Germany&#039!<BR><BR>Lets assume you have a table in your database with a field Country.<BR><BR>Then you can select all the records matching &#039France, Germany&#039 with:<BR><BR>SQL = "Select * from Table where Instr(&#039" & request("CountryField") & "&#039, Country) &#062; 0"<BR><BR>I&#039m not sure but I think this one will work ...<BR><BR>If not you can also try ...<BR><BR>SQL = "Select * from Table where Country = &#039" & replace(request("CountryField"),", ","&#039 or Country = &#039") & "&#039"

Posting Permissions

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