i want code by visual basic 5 (search code for db by access connect with vb5) because i made one but search only give me one result on(( first one only)) for example -- after i enterd data in db and then i want search for any filed such i search for product name : a1 he give me first one and didn't the other .. if there anoter method to get search to next product name as example ,,,, sorry for long in explain the question

another question also i made crystal report and i want to put search command in report to search in fileds so if there is code can any one write this code to me
finally thanks to all

i want code by visual basic 5 (search code for db by access connect with vb5) because i made one but search only give me one result on(( first one only)) for example -- after i enterd data in db and then i want search for any filed such i search for product name : a1 he give me first one and didn't the other .. if there anoter method to get search to next product name as example ,,,, sorry for long in explain the question

another question also i made crystal report and i want to put search command in report to search in fileds so if there is code can any one write this code to me
finally thanks to all

-----------------------------------------
Private Sub cmdSearch_Click()
Dim search
search = InputBox("please enter card no", , "")
Data1.RecordSource = "SELECT * FROM waqf WHERE cardno LIKE (""" & "*" & search & "*" & """)"
Data1.Refresh
End Sub
-----------------------------

Private Sub cmdnewsearch_Click()
Dim s
s = InputBox("enter name", , "")
Data1.RecordSource = "SELECT * FROM waqf where cardno LIKE '%" & Trim(s) & "%'"
End Sub


-----
when i put code and run program and begin search didn't give me any result plz answer and exlplain to me ,, thank u Jx_Man

try the following syntax

Data1.RecordSource = "SELECT * FROM waqf where cardno LIKE '*" & Trim(s) & "*'"

regards
Shouvik

The following code should work for you.

Data1.RecordSource = "SELECT * FROM waqf where cardno LIKE "'%" & Trim(s) & "%'"

This article has been dead for over six months. Start a new discussion instead.