Hai Every body
I am using Ms Access 2003 and Vb6
Table name is : accgeneral
field name is : Author
Text box name : Text1
Listview1 is the name of the Listview control
'*b*' is working in Access query
But it is not working as Sql Select statement like below:
is not working, it simply clear the listview control in run mode, it is not giving any errors, but not working.Code:rs.Open "Select * from accgeneral where Author like '*" & Text1.Text & "*'", db, 3, 3
My requirement is find the character where in the name of the author
above line code is working in access query created from the table accgeneral
The below code is working well.
Thanks in advanceCode:Private Sub txtsearch_Change() ListView1.ListItems.Clear Dim list As ListItem Dim x As Integer connectDB rs.Open "Select * from accgeneral where AccNo like '" & txtsearch.Text & "%'", db, 3, 3 Do Until rs.EOF Set list = ListView1.ListItems.add(, , rs(0)) For x = 1 To 12 If Not IsNull(rs(x)) Then list.SubItems(x) = rs(x) End If Next x rs.MoveNext Loop Set rs = Nothing db.Close: Set db = Nothing End Sub


Reply With Quote

