Results 1 to 2 of 2

Thread: Using Find in ADO

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 1999
    Location
    Seattle WA USA
    Posts
    21

    Post

    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?

    ------------------

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    You can try something like this:

    Code:
        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
    [email protected]
    [email protected]



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width