Results 1 to 3 of 3

Thread: ADO Seek ?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    UK
    Posts
    5

    Post

    I have been using DAO for a while now and use the SEEK command to jump to records based on an index set. I have now converted an app over to ADO and have noticed there is no SEEK command. I have been using the FIND Command but that seems extremely slow in comparison. Is there another way in ADO of achieving this and also sppeding up the execution ?

    Mucho Graciaso !

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    You can optimize a field at runtime by setting the dynamic "OPTIMIZE" value at runtime. Then you can use ADOs FIND, SORT, and FILTER that take advantage of these indexes. These indexes are created at runtime and DO NOT change any values/properties in your underlying table.

    Code:
        Dim rs As Recordset
        Dim cn As Connection
        Dim fld As Field
        
        Set cn = New Connection
        Set rs = New Recordset
        
        cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NWind2k.mdb"
        
        With rs
            .ActiveConnection = cn
            .Source = "Customers"
            .CursorLocation = adUseClient
            .CursorType = adOpenKeyset
            .Open
            
            Set fld = .Fields("CustomerID")
            fld.Properties.Item("Optimize").Value = True
            
            .Find = "CustomerID = 'FRANR'"
            
            If .RecordCount > 0 Then
                MsgBox "Found!"
            Else
                MsgBox "Not Found!"
            End If
                
        End With

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    UK
    Posts
    5
    I tried the mentioned code and couldnt get it to work !

    Any Ideas ???


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