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

Populate List Box with search results.

Status
Not open for further replies.

Skinsella

Programmer
Feb 20, 2001
23
GB
What I have is a form with a text box that is used as a search screen. At run time the user can type something into the box and then press a button, which brings up a pop up screen displaying a Listbox which I need to be populated with the search results. Below is what I've got so far but for some reason only the first result found is displayed, but there should be at least 5 records for each employee.


Dim LT As String
Dim ST As String
LT = Form1.txtSearch.Text
ST = "SELECT * FROM TblSEF WHERE EmployeeName = '" & LT & "'"
DataEnvironment1.rsTblSEF.Open (ST)
Do Until DataEnvironment1.rsTblSEF.EOF
List2.AddItem DataEnvironment1.rsTblSEF("BusCity")
DataEnvironment1.rsTblSEF.MoveNext

Exit Do
Loop
DataEnvironment1.rsTblSEF.Close
 
Hey John thanks for that. I feel like a right idiot, lol. Still pretty new at this game and learnign on my feet. Anyway thanks again, much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top