Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query with Multiple Checkboxes

Status
Not open for further replies.

Pear29

Programmer
Jul 26, 2001
1
US
I am using ASP to to query an Access database. I have a dynamic number of checkboxes depending on the user. The user selects an undetermined number of checkboxes which are branch numbers. I need to query the database for all people from those branches. It works if one branch is selected but it does not for multiple branches. My current SQL query is:

SQLQuery = "SELECT * FROM Employee_Information WHERE LOCATION = '" & Request.Form("C1") & "'"

Location = the branch number; C1 = name of all checkboxes.

Thanks
 
For clarification:

C1 = name of all checkboxes

What do you mean by this?
How can C1 = all checkboxes?
How many checkboxes are on the page?

Do you mean to say something like:

WHERE Location = A or B or C or D?

Sure I can help if I understand a little bit better.
Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
The number of checkboxes depends on the person who logs in. The situation is, a manager, who can manage more than one branch, logs in. The branches he manages are displayed with checkboxes next to them so that he can select them in order to get information about the employees for any combination of the branches. The checkboxes are created with this code:

While Not rsEmp.EOF%>
<tr>
<td width=&quot;50%&quot;><input type=&quot;checkbox&quot; name=&quot;C1&quot; value=&quot;<%=rsEmp(&quot;BRANCH_MANAGED&quot;)%>&quot;><%= rsEmp(&quot;BRANCH_MANAGED&quot;)%></td>

All of the checkboxes are named C1 so that when they are checked the values are put in an array of C1 and if displayed the values are separated by a comma. e.x. 421, 567

I need to query the database on a separate page for all employees that have a location that matches the branch number(s) checked. Right now if only one branch is checked it works with the Query in the first message. I need to know how to get a hold of each value in C1 and query for each row that contains one of the values. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top