Dear DreamMater,
There 's no problem if the variable is "monkey" only.
But the variable "box" is a multiple selection variable, if variable box has the values "monkey" & "dog", the query will fail.
Please help!
Main Topics
Browse All TopicsDear Experts,
I have create an selection box on a web page to query a access database and display the record set on the next page.
The selection box name is "box"
And the record set definition of the result page is:
select * from database where boxfield like 'box%'
There was no problem to display single selection criteria from selection box.
But when I select multiple values from the selection box,
nothing will be display on the result page.
Please advise.
Thank you.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You can try this.
Open up your ASP page in Ultradev and switch to code view.
Find your line #3, it should be just below the line of Include file of your database connection.
Paste this in
<%
box = Replace (Request("box"), ", ", "','" )
SQL = "select * from Current where Counter in ('" & box & "')"
%>
After that, edit your source of Recordset and replace it with SQL
Recordset1.Source = SQL
Your code should look like this.
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/DATABASE
<%
box = Replace (Request("box"), ", ", "','" )
SQL = "select * from database where boxfield in ('" & box & "')"
%>
<%
set Recordset1 = Server.CreateObject("ADODB
Recordset1.ActiveConnectio
Recordset1.Source = SQL
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
Good luck!
Sherly
Business Accounts
Answer for Membership
by: DreamMasterPosted on 2002-01-17 at 01:19:20ID: 6738902
Let me get this straight, if I understand correctly you want to use the value of a selectbox to query the database am I correct??
If so, first of all I take it that you have allready retrieved the value from the select box, but the like statement will now only find values that are starting with box and have anything (or nothing) after that..
The way you have done it now, the string "box" is the search criteria..
The proper way of doing this would be:
select * from database where boxfield like '" & box & "%'"
See if this helps you, it now uses the value that is in the variable "box" and parses that into the query, so if there would have been the word "monkey" in the variable box, the query would be:
select * from database where boxfield like 'monkey%'"
Max.