Unable to get the ADO Seek Method to work

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

I am running Access 2000 with Microsoft Jet OLEDB 4.0.
In VB I create a connection and a recordset. When I run
the recordset.Supports(adSeek) function, the provider
appears to NOT support the Seek method.

Any ideas?

Thanks in advance.

Brad
 
Doug,

Thanks; I checked that link and it appears I am doing just
about the same as the article. Here is a chunck of code:

Public Function AAA()
'The connection is to Microsoft Jet OLEDB 4.0
'. other code

Dim cnn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim rst2 As New ADODB.Recordset

Set cnn = CurrentProject.Connection
rst2.CursorLocation = adUseClient

rst.Open "Select * From [Table One]", cnn,
adOpenForwardOnly, adLockReadOnly, adCmdText


rst2.Open "Select [Field one], [Field two], Active From
[Table Two]", cnn, adOpenKeyset, adLockOptimistic,
adCmdTableDirect

'Debug now
If rst2.Supports(adIndex) Then
MsgBox "supports adindex"
End If
'The rst2 does not support the index

If rst2.Supports(adSeek) Then
MsgBox "supports adseek"
End If
'The rst2 does not support Seek

'Build a compound index
rst2("Field one").Properties("Optimize") = True
rst2("Field two").Properties("Optimize") = True

'. more code




Let me know what you think.
Thanks,

Brad
 
While it may be close, there's a critical difference.

You've got:

rst2.CursorLocation = adUseClient

Carl's got:

oRS.CursorLocation = adUseServer



--
Doug Steele, Microsoft Access MVP



Brad said:
Doug,

Thanks; I checked that link and it appears I am doing just
about the same as the article. Here is a chunck of code:

Public Function AAA()
'The connection is to Microsoft Jet OLEDB 4.0
'. other code

Dim cnn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim rst2 As New ADODB.Recordset

Set cnn = CurrentProject.Connection
rst2.CursorLocation = adUseClient

rst.Open "Select * From [Table One]", cnn,
adOpenForwardOnly, adLockReadOnly, adCmdText


rst2.Open "Select [Field one], [Field two], Active From
[Table Two]", cnn, adOpenKeyset, adLockOptimistic,
adCmdTableDirect

'Debug now
If rst2.Supports(adIndex) Then
MsgBox "supports adindex"
End If
'The rst2 does not support the index

If rst2.Supports(adSeek) Then
MsgBox "supports adseek"
End If
'The rst2 does not support Seek

'Build a compound index
rst2("Field one").Properties("Optimize") = True
rst2("Field two").Properties("Optimize") = True

'. more code




Let me know what you think.
Thanks,

Brad
-----Original Message-----
How have you defined the cursor type and location?

See http://www.able-consulting.com/ADO_Faq.htm#Q23 at Carl Prothman's site
for how to get it to work.

--
Doug Steele, Microsoft Access MVP






.
 
Any ideas?

1) Don't use Seek: use the normal .FindFirst etc methods

2) Don't use Seek: use the normal SQL commands to get the records you want
in the first place

B Wishes


Tim F
 
Doug,

Thanks. I did use that but had no luck. I had wanted to
build a dynamic index with ADO using rst2("Field
one").Properties("Optimize") = True; and in order to use
that you must have "adUseClient".

So, I redesigned and built an index in a prior step and
now want to use the Seek Method. I did change the code to
use "adUseServer" - but still have the same problem.

Sure appreciate your response - any other ideas?
Thanks.

Brad Young
-----Original Message-----
While it may be close, there's a critical difference.

You've got:

rst2.CursorLocation = adUseClient

Carl's got:

oRS.CursorLocation = adUseServer



--
Doug Steele, Microsoft Access MVP



Brad said:
Doug,

Thanks; I checked that link and it appears I am doing just
about the same as the article. Here is a chunck of code:

Public Function AAA()
'The connection is to Microsoft Jet OLEDB 4.0
'. other code

Dim cnn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim rst2 As New ADODB.Recordset

Set cnn = CurrentProject.Connection
rst2.CursorLocation = adUseClient

rst.Open "Select * From [Table One]", cnn,
adOpenForwardOnly, adLockReadOnly, adCmdText


rst2.Open "Select [Field one], [Field two], Active From
[Table Two]", cnn, adOpenKeyset, adLockOptimistic,
adCmdTableDirect

'Debug now
If rst2.Supports(adIndex) Then
MsgBox "supports adindex"
End If
'The rst2 does not support the index

If rst2.Supports(adSeek) Then
MsgBox "supports adseek"
End If
'The rst2 does not support Seek

'Build a compound index
rst2("Field one").Properties("Optimize") = True
rst2("Field two").Properties("Optimize") = True

'. more code




Let me know what you think.
Thanks,

Brad
-----Original Message-----
How have you defined the cursor type and location?

See http://www.able-consulting.com/ADO_Faq.htm#Q23 at Carl Prothman's site
for how to get it to work.

--
Doug Steele, Microsoft Access MVP



I am running Access 2000 with Microsoft Jet OLEDB 4.0.
In VB I create a connection and a recordset. When I run
the recordset.Supports(adSeek) function, the provider
appears to NOT support the Seek method.

Any ideas?

Thanks in advance.

Brad


.


.
 
Back
Top