Non-repeating values in drop down

L

lc

Hi,
I want to display the data from the database in a drop-
down list. However, some items are repeating and I was
wondering how can I display only unqiue values.
<%
strSQL3 = "SELECT tblEV3Location.Code FROM
tblEV3Location ORDER BY

tblEV3Location.Code;"
set cars3=adoCon.execute(strSQL3) %>
<select name="Code">
<% 'Loop through the recordset to make each entry
in the list. %>
<% do while not cars3.eof %>
<Option value = "<%= cars3(0) %>"> <%=
cars3(0) %></Option>
<%cars3.movenext
loop%>
</select>

Thanks.
 
K

Kathleen Anderson [MVP - FP]

Try:

strSQL3 = "SELECT DISTINCT tblEV3Location.Code FROM tblEV3Location ORDER BY
tblEV3Location.Code;"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top