Search Tools Links Login

Select List Thingy

*UPDATED 10-23-00* Now with more options, including multiple select, size, and default selected option. Quickly and easily creates select list combo boxes from a database for your web forms. Uses .GetString rather than recordset looping.

Original Author: Will Knoll


See Code Comments...


I place the code in an include file which I link to from the pages in which I am building select lists. I use this with SQL Server, not sure what results will be with other databases, but it should work okay.


Returns a string with all of the code for your select list. All you need to do to display it is a Response.Write() or <%=varname%>

Side Affects

Your Recordset can only contain two columns for this to work properly. Example SQL: "SELECT usr_id,usr_name FROM users". The first column will be used for the VALUE of the option, the second column will be the display value.


'* Function Name: buildCombo
'* Syntax : myVar = buildCombo
'* Parameters :
'* rsRecordset - Name of an OPEN
'* recordset with 2 fields
'* strComboName - String with the name
'* you want to appear in
'* "
strCombo = ""
exit function
End If
End With
strCombo = strCombo & ""
i = InStrRev(strCombo,"

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 96 times




No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.