Hi
I want to enter a coding which should find farzana though i type far or zana in the txtsearch.Text.
if txtsearch.Text = far
then it should display a record existing with farzan or farhan or any other record having far in the record.

can some body please help me :
rs.Find "first_name='" & Trim(txtsearch.Text) & "'"
If rs.EOF Then
MsgBox ("Record Not Found")
Else
MsgBox ("Found")
'display2
'displaywithloop2
End If
End If

hi. if you want you can search while you type. here is the code i have on my software and ill just edit it for your use.

Private Sub textbox_Change()

listbox.clear

db.recordset.movefirst
do while not db.recordset.EOF
       if instr(1,textbox.text, db.recordset!Name ,1)
             listbox.additem db.recordset!Name
       end if
loop

end sub

i just typed the code directly here in daniweb so if there's something wrong with it im sorry. lol

then it should display a record existing with farzan or farhan or any other record having far in the record.

where it will display? like any where.......... drewpee write nice. actually it depend on you.

rs.Find "first_name='" & Trim(txtsearch.Text) & "'"

this type of code not use more:-/. so I attach some sample project. you can try it. I don't know how much benefit you will get.....:?:

Hi
I want to enter a coding which should find farzana though i type far or zana in the txtsearch.Text.
if txtsearch.Text = far
then it should display a record existing with farzan or farhan or any other record having far in the record.

can some body please help me :
rs.Find "first_name='" & Trim(txtsearch.Text) & "'"
If rs.EOF Then
MsgBox ("Record Not Found")
Else
MsgBox ("Found")
'display2
'displaywithloop2
End If
End If

hi,

i hope this helps you.
i have used a table named 'tbl_type' which has a field named 'Type' which holds the list of names you want to search through and then lists the result in the list control named 'lsttyp'.

here is the code

Private Sub txtsearch_KeyUp(KeyCode As Integer, Shift As Integer)
If txtsearch.Text = "" Then
Exit Sub
Else
lsttyp.Clear
  With rssearch
    If .State = adStateOpen Then .Close
    .Open "select * from tbl_type where left(type," & Len(txtsearch.Text) & ") like '" & txtsearch.Text & "'", cn, adOpenDynamic, adLockOptimistic
    Do While Not .EOF
      lsttyp.AddItem !Type
    .MoveNext
    Loop
  End With
End If
End Sub

you will edit the code to your style of coding.
good luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.