Split database, returning error 3251

S

Sean

hello,

I have recently split a database to allow me to easily maintain and develop
it. however, when I open a form that populates a list box from a coded query
I get the error.
"Run-time error 3251
Operation is not supported for this type of object."

I have included the code below. It falls over at every mention of "rst.="
and "rst2=". Any ideas? (it works fine in the un-split database) I have not
included all the code just up to where it falls over. I think that once I can
get over this problem the rest will work fine.

Many thanks in advance

Sean


Private Sub Form_Load()

Me.Text6 = Date - 14
Me.Text8 = Date + 14
Dim dbs As Database, tdf, tdf2 As TableDef, rst As Recordset, rst2 As
Recordset

' Return reference to current database.
Set dbs = CurrentDb

' Return reference to table.
Set tdf = dbs.TableDefs!problem_status 'solutions table, used for the
problem types
Set tdf2 = dbs.TableDefs!problem_status_MI ' the one where the call
numbers are recorded

' Open table-type Recordset object.
Set rst = dbs.OpenRecordset("problem_status")
Set rst2 = dbs.OpenRecordset("problem_status_MI")

' Set current index to new index.
rst.Index = "status_counter"
rst2.Index = "problem_status"

' create a record in the call_main_MI* tables to give a current record
starting point
rst2.AddNew
rst2.Update

' Specify record to find.
rst.Seek "=", "1"
rst2.Seek "=", Null
If rst.NoMatch Or rst2.NoMatch Then
Debug.Print "Seek failed."
Else
' populate the recordcounts for the original tables
rst.MoveLast
rst.MoveFirst
 
B

Brendan Reynolds

You can't open a table-type recordset on a linked table. When you don't
specify the recordset type, the default is table-type for local tables,
dynaset for linked tables.

You can't use .Index or .Seek on any type of recordset other than
table-type. You can re-write the code to use .FindFirst instead of .Seek, or
you can open a connection to the back-end data file using OpenDatabase if
you want to continue to use .Seek.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

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