Private Sub Command1_Click()
Dim Searchvar As String

Searchvar = InputBox("Enter the Name to find")
Searchvar = Trim$(Searchvar) 'remove surplus spaces
If Searchvar <> " " Then 'cancel if nothing entered
With Adodc1.Recordset

.Find "[Title of Books] = '" & Text1.Text & "'", , adSearchForward
If (.EOF) Then 'record not found
MsgBox "No file found"

End If
End With

End If

End Sub


****

guys this is the code I used, yes it works but then it just display "FILE NOT FOUNG" all over again. I dont know where the problem is.

Help me guys, you are more trained and experienced in this forte..thank you

I personally prefer the use of ADO. It gives you so much more control over queries than a data control. Reference MS Active X data objects 2.x under references. The code will be -

Private Sub Command1_Click()

Dim con As ADODB.Connection
Set con = New ADODB.Connection

Dim rsSearch As ADODB.Recordset
Set rsSearch = New ADODB.Recordset

con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\MyDatabaseName.MDB;Persist Security Info=False"
    
rsSearch.Open "SELECT * FROM MyTableName WHERE [Title of Books] LIKE " & "'" & Text1.Text & "'%", con, adOpenStatic, adLockOptimistic
'The LIKE function searches the database fo names that is similar than what you typed in text1...

If rsSearch.EOF = True Or rsSearch.BOF = True Then
    MsgBox "No Record Found"
        Else
    'Do here what you need if the file was found...
End If

rsSearch.Close
con.Close
End Sub

thanks for the code it helps...

Its a pleasure.:)

Please mark this as solved, found at the bottom of this page, thanks.

Dear Sir,

Please help me on record search in vb6 with access database. My requirement is date of birth and mobile number both are matching then all record are shown

i m waiting your reply