Combine Two Record Sets from Access in One Select List:
This example is for an update page.
Code:
update.asp
Highlight
<% dim conn, rs, rs2, strID, strconn, strsql, strsql2, DBQValue set conn = server.createobject("adodb.connection") set rs = server.createobject("adodb.recordset") set rs2 = server.createobject("adodb.recordset") conn.open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & server.mappath("DATABASE NAME.mdb") strsql = "select * from DATABASE OR QUERY NAME where" strsql = strsql & " ID = " &_ Request.Querystring("ID") rs.open strsql, conn, 2, 2 strsql2 = "select * from DATABASE OR QUERY NAME where" strsql2 = strsql2 & " ID = " &_ Request.Querystring("ID") rs2.open strsql2, conn, 2, 2 end if%> <% rs.movefirst Do While NOT rs.EOF %>
">
Division:
<%Do While Not rs2.EOF%>
" <%if rs2("Division_ID") = rs("Division_ID") then%> Selected <%end if%> ><%=rs2("Division_Name")%>
<%rs2.movenext%> <%loop%>
<% rs.movenext Loop %> <% rs.close rs2.close conn.close set rs = nothing set rs2 = nothing set conn = nothing %>