Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamic Listbox based on previous listbox

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-21 : 08:49:37
Pedro writes "I know this has to be done with onChange However I am unsure as to how. I have a room reseveration system. When a user selects a room (can be multipule as long as the CampusID [not shown] matchs) Then I need to equipment available to that Campus to populate into a select box. I can use Java as there is way too much information to have to put into it.

MS Advanced Server 2003
MS SQL Server 2000

Here is what I have thought up so far.


<select name="selRoom" size="5" multiple>

'objRS.MoveFirst
Do While Not objRS.EOF
Response.Write ("<option value='" & objRS("RoomID") & "'>" & objRS("RoomName") & " - " & objRS("RoomNumber") & "</option>")
objRS.Movenext
Loop

</select>


Requested Equipment:
<select name="selEquipment" size="5" multiple id="selEquipment" onChange=?>

'Added in case I have to open the database again to get the info I need (not used currently)
'strSQL2 = "SELECT Equipment.EquipmentName, Equipment.EquipmentID " & _
'"FROM (Campuses INNER JOIN Equipment ON Campuses.CampusID = Equipment.CampusID) INNER JOIN Rooms ON Campuses.CampusID = Rooms.CampusID;"

'objRS.MoveFirst

Do While Not objRS2.EOF
If objRS("CampusID") = objRS2("CampusID") Then
Response.Write ("")
objRS.MoveNext
End If
Loop

</select>

refered from 4guysfromrolla"

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-01-21 : 11:03:00
Do a search for "dependant drop down boxes" on google, and that should give you a few possible solutions.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
   

- Advertisement -