Click to See Complete Forum and Search --> : Using Find in ADO
DVint
Aug 30th, 1999, 08:16 PM
OK, I finally understand (I sincerely hope) how to connect to a database with ADO. Now I'd like to be able to do something like use a simple Find function. You'd think there would be some examples in Help, but instead it seems like every help topic in VB6 is about how wonderful everything Microsoft does and how much more wonderful everything is going to be in the future, and how simple it all really is. How do you do a simple Find?
------------------
Serge
Aug 30th, 1999, 10:29 PM
You can try something like this:
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
cn.Provider = "Microsoft.Jet.OLEDB.3.51"
cn.Open "D:\Microsoft Visual Studio\VB98\Nwind.mdb", "admin", ""
rs.Open "Select * from Customers", cn, adOpenStatic
rs.Find "CompanyName like 'Blauer*'"
If rs.EOF Then
MsgBox "Record not found."
Else
MsgBox "You found your record."
End If
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.