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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database to drop down menu

Status
Not open for further replies.

fatmbk

Technical User
Jul 11, 2002
29
0
0
GB
Hi,

I think it's a relitivly simple question but does anyone know how to get data from 1 coloumn of an Access database table into a drop down menu in a form?

Cheers,

Fatmbk
 
Collect a recordset for the column using an SQL select statement and then collect the recordset.count value, use this value to then enter a for loop. Before entering the loop output the opening form input tag for the drop down list. Then use this loop to iterate through the different options in the recordset sorround the variables with the <option> tag and then at the end of this loop use the recordset.movenext function to get the loop to collect the next option
 
Create a recordset (objRS) with the desired contents and then try this...
Code:
<select name="myDropDown">
<%
While NOT objRS.EOF
  Response.Write "<option value="" & objRS("id") & "">" & objRS("Name") & "</option>" & vbcrlf
  objRS.MoveNext
Wend
%>
</select>

Tony
[red]_________________________________________________________________[/red]
Webmaster -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top