Click to See Complete Forum and Search --> : ADO Seek ?
ScAL
Jan 19th, 2000, 07:48 PM
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 !
Clunietp
Jan 20th, 2000, 11:19 AM
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.
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
ScAL
Mar 29th, 2000, 10:09 PM
I tried the mentioned code and couldnt get it to work !
Any Ideas ???
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.