PDA

Click to See Complete Forum and Search --> : ADO seek method


vijman
Sep 25th, 1999, 04:29 AM
Why the following code gives an error message
at
<rst.Index = "PrimaryKey">
"Compile error
Method or data member not found"


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

Set cnn = New ADODB.Connection
cnn.Open "provider=Microsoft.Jet.OLEDB.4.0;data source = c:\project\vb\access\masters.mdb;"

Set rst = New ADODB.Recordset
rst.Index = "PrimaryKey"
rst.Open "Itemmast", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect

rst.Seek "=", Text1.Text
If Not rst.EOF Then
Form1.Text2.Text = rst.Fields(1).Value
End If
rst.Close

Serge
Sep 26th, 1999, 10:38 PM
ADO's Recordset object doesn't have Seek method. It has Find method.

Usage:rs.Find Criteria, [Skip Records As Long], [Search Direction As SearchDirectionEnum=adSearchForward], [Start]

Example:rs.Find "LastName Like 'A%'"

Regards,

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

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com




[This message has been edited by Serge (edited 09-27-1999).]

vijman
Sep 27th, 1999, 04:34 AM
Thanks for your information.

I found some examples in MSDN Library (July 1999) under the following heading

"Microsoft Data Access Components 2.5 SDK Beta - ADO"

Is the above one is a new component ?


Thanks & Regards

Vijman

Serge
Sep 27th, 1999, 06:20 PM
ADO 2.5 will be released with Windows2000. The new version of ADO will have XML support (which is pretty cool, I've seen it in action on Microsoft DevDays conference).

Regards,

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

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com