Jump to content

using two user choices for query


Guest j-w-thomas

Recommended Posts

Guest j-w-thomas

I customized the example in W3Schools ADO examples (link below)http://www.w3schools.com/ado/showasp.asp?f...me=demo_query_4to use my database etc. It works great so far. I was now hoping that I could add on another select list created by the same rs. The result shows the first drop down list, but the second one is empty. Is this even possible? Should I create a second rs set for the second drop down list?Thanks...Most of the code is below:<html><head><script LANGUAGE="JavaScript"><!-- Beginfunction varitext(text){text=documentprint(text)}// End --></script></head><body><%set myconn=Server.CreateObject("ADODB.Connection") myconn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0"myconn.open server.mappath("fpdb/balances_07.mdb")set rs=Server.CreateObject("ADODB.recordset")sql="SELECT DISTINCT sun_f_date,Location FROM Payroll_Forecast"rs.Open sql, myconnweek=request.form("week")loc=request.form("location")%><form method="post">Choose Week <select name="week"><% do until rs.EOF response.write("<option>") response.write(rs.fields("sun_f_date")) rs.MoveNextloop %></select>Choose Location <select name="location"><% do until rs.EOF response.write("<option>") response.write(rs.fields("Location")) rs.MoveNextloop %></select><%rs.Closeset rs=Nothing%><p><input type="submit" value="Show Schedule"> </p></form><br><%if week<>"" then sql="SELECT [Last Name],Location,sun_start,sun_stop,sun_f_hours,mon_start,mon_stop,mon_f_hours,tue_start,tue_stop,tue_f_hours FROM Payroll_Forecast WHERE sun_f_date='" & week & "' AND Location='" & loc &"'" set rs=Server.CreateObject("ADODB.Recordset") rs.Open sql,myconn%> <table width="250" border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0"> <tr> <th>Week Starting</th> <th>Location</th> </tr> <tr> <td><%response.write(week)%></td> <td><%response.write(rs.fields("Location"))%></td> </tr> </table><br><br>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...