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!

filling a drop down list

Status
Not open for further replies.

allyeric

Programmer
Mar 14, 2000
104
0
0
CA
Visit site
hi<br><br>I am getting information from the database, from one certain column.&nbsp;&nbsp;I put it into an array, which I inserted into the drop down list.&nbsp;&nbsp;But, my problem is, in the database, some of the information is entered more than once, for different records.&nbsp;&nbsp;I don't want double values listed in drop down box.&nbsp;&nbsp;Here is my code:<br><br>For lQuestionNumber = 1 To 110<br> strSQL = &quot;SELECT * from Emp_Answers where No_Employe = &quot; & CInt(EmpNo)<br>&nbsp;&nbsp;&nbsp;&nbsp;set rs = con.execute(strSQL)<br>&nbsp;&nbsp;&nbsp;&nbsp;strExamNo = rs(&quot;Exam_No&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;strSQL = &quot;SELECT * FROM Exam_SRHEX&quot; & strExamNo & &quot; where Question_No =&quot; & lQuestionNumber<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rs = con.Execute(strSQL)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;While Not rs.EOF<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for index = 0 to (lQuestionNumber-1)<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if InStr(rs(&quot;Answer_Text&quot;), sAnswers(index)) = 0 then <br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sAnswers(lQuestionNumber - 1) = rs(&quot;Answer_Text&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if<br>&nbsp;&nbsp;&nbsp;&nbsp; next<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sQuestionNo(lQuestionNumber - 1) = rs(&quot;Question_No&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rs.MoveNext<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wend<br>Next<br><br><br>this now gives me no values in the dropbox - can someone please give me some advice?&nbsp;&nbsp;(I didn't put here the code to add data to drop box, cause that was working fine until I tried the If InStr command.)<br><br>Thanks in advance&nbsp;&nbsp;&nbsp;:eek:)<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top