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!

Dropdown menu for DB Selection 1

Status
Not open for further replies.

dburnham

Programmer
Oct 18, 2001
118
US
I am using frontpage to support a database site. I would like to give the users a dropdown selector for "categories" within the DB. I know how to add a dropdown list to my form but I do not know how to make the form, or the SQL, know that the "CategoryField" should = "CategoryDL".

Any and all help is appreciated.

David
 
Here's a sample in code:

<option selected>--Select Below--</option>
<%
Dim RS1,SQL1,oConn
Set oConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
oConn.Open(&quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=Location to your database&quot;)

SQL1 = &quot;SELECT * FROM categories ORDER BY CategoryDL&quot;
Set RS1 = oConn.Execute(SQL1)
Do While NOT RS1.EOF
%>
<option value=&quot;<%=Trim(RS1(&quot;CategoryD&quot;))%>&quot;><%=Trim(RS1(&quot;CategoryD&quot;))%></option>
<%
RS1.MoveNext
Loop
Set RS1 = Nothing
Set SQL1 = Nothing
oConn.close
%>
</select>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top