Full Version: Seek not working
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
PeterMiller
Hi everyone,

I have a command button on a form that uses the data entered into an unbound textbox as the criteria for a seek on an applicable index field of a recordset.
I have the seek process of finding a record working in other modules - but in this instance I get the error message 'Operation is not supported for this type of operation' ???

Code:
Dim db As Database
Dim rstVehs As DAO.Recordset
Dim strRego As String

Set db = CurrentDb()
Set rstVehs = db.OpenRecordset("tblVehicles")
strRego = [Forms]![frmOpLookup]![txtRegoNo]
rstVehs.Seek "=", strRego

It fails on .Seek command line - What am I doing wrong ?

Any help appreciated.
LPurvis
You've not specified an index - however the problem is perhaps that tblVehicles might not be a local table.
Is it linked?
PeterMiller
Sorry, I forgot to show the index line of code in my previous post:

rstVehs.Index = "PrimaryKey" (which is placed before the seek command line)

But you're also correct - the tables are now linked - which they weren't when I previously used this seek process in another module.

So what do I now need to do differently - now my tables are linked.

Thanks
LPurvis
Yep - you're opening a dynaset recordset by default now.
Only Table type recordsets support Seek - and you can't open a linked table in that mode.
Your choices are outlined (eventually) in this thread here.
If you need that abbreviated at all, no probs - just ask :-)
PeterMiller
Thank you Leigh - much appreciated. Peter
LPurvis
No worries.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.