Drop-down menu, Allow multiple selections

J

jeffp

Anyone know how to write the code for a results page,
which gets its criteria from a Drop-down menu that has
Allow multiple selections enabled?

Everything works fine if you only select one item from
the drop-down menu. Of course, if you select more than
one item, you get zero.
 
J

Jim Buyens

jeffp said:
Anyone know how to write the code for a results page,
which gets its criteria from a Drop-down menu that has
Allow multiple selections enabled?

Everything works fine if you only select one item from
the drop-down menu. Of course, if you select more than
one item, you get zero.

You would have to create a custom ASP or ASP.NET page.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
G

Guest

Jim Buyens,
i have the exact same problem, i would like to see if you
get any help, please email me at (e-mail address removed)

thank-you,
Ned Miller
 
K

Kathleen Anderson [MVP- FP]

xmas:
that won't work - that's making separate single selections from 2 different
menus. :-(
 
J

Jim Buyens

i have the exact same problem, i would like to see if you
get any help, please email me at (e-mail address removed)

thank-you,
Ned Miller

Well, suppose you have this form.

<form method="POST">
<p><select size="4" name="direction" multiple>
<option value="n">North</option>
<option value="s">South</option>
<option value="e">East</option>
<option value="w">West</option>
</select></p>
<p><input type="submit" value="Submit" name="btnSub"></p>
</form>

The code to build a SQL statement would look like this:

<%
dim sql
dim pos
if request.form("btnSub") <> "" then
sql = "SELECT * FROM mytable "
for pos = 1 to request.form("direction").count
if pos = 1 then
sql = sql & " WHERE "
else
sql = sql & " OR "
end if
sql = sql & " (direction = '" & request.form("direction")(pos) & "') "
next
end if
%>

If, for example, you select North and West, you get:

SELECT * FROM mytable WHERE (direction = 'n') OR (direction = 'w')

You would then need to open a database connection, use this SQL
statement to open a recordset, and then loop through each returned
record, writing an HTML table row into the response stream for each
one.

Note that you'll need to write all the ASP (or ASP.NET) code for this
page yourself. This isn't something you can feed into the Database
Results Wizard.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top