I just did this. I found a Java that would do it, but since that cost $$ and I refuse to pay for what I can make, I instead created this in .ASP:
<% FIELD_VARIABLE = "Default Value Here" 'set default value %><%
RESPONSE_VARIABLE = "<SELECT name='FIELD_VARIABLE'><OPTION value=''>Please Select</OPTION>"
sqlwrk = "SELECT DISTINCT [NAME_OF_FIELD] FROM [NAME_OF_TABLE] ORDER BY [NAME_OF_FIELD] ASC"
Set rswrk = Server.CreateObject("ADODB.Recordset"

rswrk.Open sqlwrk, conn, 1, 2
If Not rswrk.EOF Then
datawrk = rswrk.GetRows
rowswrk = UBound(datawrk, 2)
For rowcntwrk = 0 To rowswrk
RESPONSE_VARIABLE = RESPONSE_VARIABLE & "<OPTION value='" & datawrk(0, rowcntwrk) & "'"
If datawrk(0, rowcntwrk) = FIELD_VARIABLE Then
RESPONSE_VARIABLE = RESPONSE_VARIABLE & " selected"
End If
RESPONSE_VARIABLE = RESPONSE_VARIABLE & ">" & datawrk(0, rowcntwrk) & "</option>"
Next
End If
rswrk.Close
Set rswrk = Nothing
response.write RESPONSE_VARIABLE
%>
NAME_OF_TABLE = The name of the table in your database
NAME_OF_FIELD = The name of the field in that table
FIELD_VARIABLE = The variable you assigned as the field name
Example: x_Field5 = Request.Form("x_Field5"
RESPONSE_VARIABLE = The variable you assign for this resulting list
Example: x_Field5List = Request.Form("x_Field5List"
The above results in a drop-down box that populates based on a particular field in a particular table. In my case I also I added a separate page in which a user can update that table and the resulting drop-down box shows their additions/deletions/changes.
Dave B
![[idea] [idea] [idea]](/data/assets/smilies/idea.gif)
Flashspot.com