Using Seek in a Front End database

S

Scott

I tried using the Seek method in a Front End database, but I received the
following error:

3251

operation is not supported for this type of object

I think that the problem is that the table I refer to is just a link in the
FE to the actual table in the BE database, doe's anyone know how to code it
so that it will work from within the FE. ?

MyField is indexed.

Code Start
*******************************************************************
Function SeekTrackingNumber()
Dim db As DAO.Database, tbl As DAO.Recordset
Set db = CurrentDb()
Set tbl = db.OpenRecordset("MyTable")
tbl.Index = "MyField"
tbl.Seek ">=", "5201"


If tbl.NoMatch Then
MsgBox "Not a record. Try another"
Else

MsgBox ("The Record is in the table")
End If
tbl.Close
End Function
********************************************************************
Code End

Thanks,

Scott
 
L

Larry Linson

What are you trying to accomplish with the SEEK? It is most often much more
efficient to open a Recordset based on a Query that includes criteria (aka
WHERE Clause) that will return just one single record (if it exists) or none
(if it doesn't). Have you considered using that option.

I do realize there are cases where you need to open the entire table and,
for one reason or another, hop from record to record, but, in my experience,
those cases are rare.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top