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

Populate a Selct box from Access Table

Status
Not open for further replies.

Dashsa

Programmer
Aug 7, 2006
110
US
Hello,
I want to populate a selectbox from the contents of a Access Table
This is my code
Code:
<%@ LANGUAGE="JScript"%>
<HTML>
<HEAD>
<TITLE>View PO Numbers</TITLE>
</HEAD>
<%



var recordSet = Server.CreateObject("ADODB.RecordSet");
	recordSet.Open("SELECT * from Data","DSN=POnum");
%>
<head>
<title>Make a choice to define your search</title>
</head>

<body>

<div>

Choose Vendor
<form action="SearchView.asp" method="get" >


 <select size="8" name="Search1" multiple style="width:1000px" width="250" >
<option value="">
		
		<%
 while(!recordSet.EOF)
 {
 %>
		
		<%=recordSet("Vendor")%>
		
		
			 <%
recordSet.MoveNext();
}
%>
		
		</option>
		<option value="">12 Marshland, LLC</option>
	
			
		</select>
	
		<br />
<input type="submit" value="Continue" />&nbsp;&nbsp; <input type="reset">
</form>
</div>


<div>

 <%
 while(!recordSet.EOF)
 {
 %>
  <%=recordSet("Vendor")%>
    <%
recordSet.MoveNext();
}
%>
</div>



</body>
</html>


It populates but does not allow me to select and go
 
I don't think this is the right forum for your question, but never mind.

The reason that you can't read the selected value for search1 is because all values are "".

<option value="">

should be something like

<option value="<%=recordSet("ID")%>">

where ID is the ID field of your table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top