how can I get my form update after search

samia

Registered User.
Local time
Tomorrow, 02:12
Joined
Feb 19, 2004
Messages
51
Hello everybody,

I've managed with the help of these forums :D to creat a search form, howver how do i get it to update for the next search results. For now it gets all mixed up.

Code:
Private Sub srchBtn_Click()

Dim dbs As Database
Dim rst As Recordset
Dim strsql As String
 Set dbs = CurrentDb
 
 strsql = "SELECT Address FROM tblPipo WHERE Address LIKE '" & Me![txtSearch] & "'"
 Set rst = CurrentDb.OpenRecordset(strsql)
 With rst
 Do Until .EOF
 List.AddItem (rst.Fields(0))
 Me.List.Requery
  
 .MoveNext
 cnt = cnt + 1
  Loop
 End With
 MsgBox "Done with Processing"
  End Sub

I tried the requery but it didnt work

Thank you,

Samia
 
Rather than looping through and adding each item, why not simply set the listbox rowsource to that SQL (changing the type to Table/Query)
 
Thank you pbaldy
 

Users who are viewing this thread

Back
Top Bottom