Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find a record with ADO??

Status
Not open for further replies.

toto2000

Programmer
Sep 25, 2001
3
CA
Hi,

I would like to know do you make to find a record in VB. I'm able to make next, previous...and now i want to make the find...if you are able to make that, well help me please!

Eric
 
Private myConn As New ADODB.Connection
Private myRS As New ADODB.Recordset

myConn .Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Database\Test.mdb"

myRS.Open "SELECT * From myTable", myConn, adOpenStatic, adLockPessimistic
myRS.Requery
Dim Question as String
Question = Inputbox("Give a name",vbQuestion+vbOKOnly)
With MyRS
.MoveFirst
.Find "Name='" & Question & "'"
If .EOF Then
MsgBox "Name " & Question & " not found.", vbOKOnly + vbExclamation
Else
MsgBox "Record found"
End If
End With

Hope this helps
Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top