-
I have a textbox named txtsearch and a listbox named list1. When I use this code it only returns the first result and no more. But I really need it to return ALL recordsets where ReportNum = txtsearch. Any Ideas? Preferably by adding to this code.
txtsearch.txt
Set RS = DB.OpenRecordset("SELECT * FROM Main WHERE _ ReportNum = '" & txtsearch.txt & "'", dbOpenDynaset)
List1.AddItem (RS!Place)
RS.Close
End Sub
-
<?>
this should do it..
if you aren't moving you get only one, the first.
Code:
txtsearch.txt
Set RS = DB.OpenRecordset("SELECT * FROM Main WHERE _ ReportNum = '" & txtsearch.txt & "'", dbOpenDynaset)
rs.refresh
rs.movefirst
While not RS.eof
List1.AddItem (RS!Place)
RS.movenext
Wend
RS.Close
Set RS = Nothing
End Sub
-
Thanks Joe