[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

classic asp; vbscript; 3 drop down lists, Need to populate each based on value choosen in one before

Asked by dbp427 in Active Server Pages (ASP), VB Script

Hi all I have three drop down lists, First one, Facility is filled with data from Access database using ADO.
After one chooses a Facility then the second one needs to have the Location populated. I can create the SQL and so forth but just need to know where on the form to put it or put some code to fill it. Then Analytes is filled after choosing a Location
Also need to pass all three values to next page using Query strings or session variables.

So the order of filling the drop down lists is
Facility which is filled now,
then Location
Then Analyte which was filled after Facility was chosen.

Hope this makes sense
TIA
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
<body> 
<%
	
	rtnCompany =Session("Company")
	
	Set fp_conn =  Server.CreateObject("ADODB.Connection")
	Set fp_rs_Facility = Server.CreateObject("ADODB.Recordset")
	Set fp_rs_Analyte = Server.CreateObject("ADODB.Recordset")
	Set fp_rs_Location = Server.CreateObject("ADODB.Recordset")
	
	fp_conn.Open Application("IHDatabase_ConnectionString")
	SQLStringFacility = "SELECT Facility, Company FROM IndustrialHygiene GROUP BY Facility, Company HAVING Company = '" & rtnCompany & "';"
	SQLStringLocation = "SELECT Facility, Location FROM [IH-Results] GROUP BY Facility, Location HAVING (((Facility)='" & Facility & "'));" 
	fp_rs_Facility.Open SQLStringFacility, fp_conn, 1, 3, 1 
	If fp_rs_Facility.recordcount = 0 then
		Response.write "Login Timed out..."%>
		
		<%Reponse.write "Please Logon again"%> 
		<%Response.write "www.ohcnet.com/logon.asp"
		Else
	fp_rs_Facility.movefirst
	End if
%> 
<p><h2>Welcome <%response.write rtnCompany %></h2></p> 
<form Name="Form1" method="POST" action="ih.asp" > 
<select size="1" name="ddSelectFacility" >
      <option selected value="Choose Facility">Choose Facility</option>
      <%TotalFacilities = fp_rs_Facility.RecordCount%> 
      <%do while not fp_rs_Facility.eof%> 
      <option><%=fp_rs_Facility("Facility")%></option>
      <%fp_rs_Facility.movenext%>
      <%loop%>
      </select> Total =&nbsp;<%=TotalFacilities%> <br>
      
      <input type="submit" value="Get Locations" name="btnGetLocations"><p>
		<select size="1" name="ddGetLocations">
		<option selected value="Choose Location">Choose Location</option>
		<option value="MyLoc">MyLoc</option>
		</select> Total = <br>
	<input type="submit" value="Get Analytes" name="btnGetAnalytes"></p>
<p> 
</form>
<%If UCase(Request.ServerVariables("HTTP_METHOD")) = "POST" Then	
	
	Facility = request.form("ddSelectFacility")
	response.write Facility 
%> 
  	<form Name="Aanalyte" method="GET" action="excel.asp">
  	<%
  		' the action above used to be ih-Analyte_Results.asp
  		'response.write "Posted to " & Facility 
  		
	SQLStringAnalytes = "SELECT * FROM AnalytePerProject Where Facility = '" & Facility & "';"
 	'response.write SQLStringAnalytes 
	fp_rs_Analyte.Open SQLStringAnalytes, fp_conn, 1, 3, 1 
	
	if fp_rs_Analyte.RecordCount >0 then
		fp_rs_Analyte.movefirst
		
	%> 
 	
   	<select size="1" name="ddSelectAnalyte">
  	<%do while not fp_rs_Analyte.eof%>
  		<option><%=fp_rs_Analyte("Analyte") %></option>
  		<%fp_rs_Analyte.movenext%>
  	<%loop%>
  	</select> Total = <%=fp_rs_Analyte.recordcount%>
  	</p>
    
		<input type="submit" value="Get Analyte Results" name="btnGetAnalytes">
		<input type="hidden" name="Facility" value="<%=Facility%>">
	</form>
	
  	<%Else%>
  		<%response.write "No Analytes found"%>
<%End if ' end record count > 0 for Analytes%>	 
	<%else
		response.write "not Posted to"
  	end if%> 
		 			
	<%Set fp_rs_Analyte = nothing%>
	<%Set fp_rs_Facility = nothing%>
   	<%Set fp_conn = nothing%>
</body>
[+][-]11/06/09 05:45 PM, ID: 25764588Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 06:33 PM, ID: 25764742Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 10:30 PM, ID: 25765201Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/07/09 11:45 AM, ID: 25767729Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 06:36 AM, ID: 25776228Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 07:19 AM, ID: 25776611Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 07:29 AM, ID: 25776711Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/09 09:42 AM, ID: 25778148Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625