currendb and link tables

  • Thread starter Thread starter May-G
  • Start date Start date
M

May-G

Hello,
I made a database that was working correctly before, but when I split the
database into two parts (Tables and one mdb and others as the other mdb), I
got this message: Operation is not supported for this type of object. Can
someone help?
Here is the code that crashed:
Private Sub Form_Open(Cancel As Integer)
Dim rsName As Recordset

If Not Me.OpenArgs = "" Then
Set rsName = CurrentDb.OpenRecordset("Staffs")
rsName.index = "loginstring" 'Here is the program crashed
rsName.Seek "=", Me.OpenArgs
If Not rsName.NoMatch Then
UserLabel.Caption = rsName!FirstName + " " + rsName!LastName
End If
End If

End Sub

Thanks in advance
 
The one thing that does not work with linked tables is the use of the seek
command.

You could use:

dim rsName as RecordSet

set rstName = currentdb.OpenRecordSet("select Staffs where login = '" &
me.OpenArgs & "'")
if rstName.ReocrdCount > 0 then
UserLabel.Caption = rsName!FirstName + " " + rsName!LastName
end if
rst.close

Note that the Above is more preferred then using the seek command. The
above also works with server based systems like SQL server. In effect it's
better to make an SQL request then to use seek. Seek as much a throwback to
the olden days when you assumed you would have the file on your local hard
desk and you could "seek" to the correct section of the hard drive. With
modern systems it is not assumed that you have a local file available, and
you make a "request" to the database engine...

If for some reason you "must" use seek, then you can use the approach
outlined here:

http://www.mvps.org/access/tables/tbl0006.htm
 
Back
Top