Multiple Drop Down Help

Results 1 to 2 of 2

Thread: Multiple Drop Down Help

  1. #1
    Tuleta Guest

    Default Multiple Drop Down Help

    Hi Guys,<BR><BR>I have a form that uses a multiple drop down box, but I can&#039;t figure out how to write my SQL statement to accept multiple entries.. here is the code I have on my ASP page, my html form page works great, the multiple drop down box is called "Ammenity"<BR><BR>(My ASP CODE)<BR>Set Conn = Server.CreateObject("ADODB.Connection")<BR>Set GetIt = Server.CreateObject("ADODB.Recordset")<BR>Conn.Ope n "DSN=PM"<BR><BR>SQL = "SELECT ParkIntersect.ParkAmmenityID, Park.ParkName FROM Park INNER JOIN ParkIntersect ON Park.ParkID = ParkIntersect.ParkID GROUP BY ParkIntersect.ParkAmmenityID, Park.ParkName HAVING (((ParkIntersect.ParkAmmenityID)= &#039;" & _<BR>Request.QueryString.Item("Ammenity") & "&#039;))"<BR> <BR>GetIt.Open SQL, Conn<BR>Response.Write "&#060;b&#062;&#060;h1&#062;Here Are The Parks That Match Your Selction&#060;/b&#062;&#060;/h1&#062;" & "&#060;vbcrlf&#062;"<BR>Do While Not GetIt.EOF<BR><BR>Response.Write vbcrlf<BR>Response.Write GetIt("ParkName")& "<BR>"<BR>Response.Write vbcrlf<BR>GetIt.MoveNext<BR>Loop<BR><BR>GetIt.Clos e<BR>Conn.Close<BR><BR><BR><BR>Any ideas,<BR>Tuleta<BR>

  2. #2
    J Guest

    Default RE: Multiple Drop Down Help

    You&#039;ll need to build & format your Having clause on the fly....<BR>You can get all of the selected criteria by looping through the forms collection...<BR><BR>Dim strItem, strHaving<BR>For Each strItem In Request.Form("Ammenity")<BR> &#039;Build your Having clause here<BR>strHaving = strHaving & "ParkAmmenityID = " & strItem<BR>Next<BR><BR><BR>you will also need to increment a counter so you know if you have more than 1 criteria to seach for. You will have to work with the loop to get your clause to format correctly (spaces, etc.). Then just concatenate the strHaving string with your SQL statement. Hope this helps.<BR><BR>J

Posting Permissions

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