Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with code after splitting in front and back end 2

Status
Not open for further replies.

Schaap

Technical User
Jul 6, 2004
54
NL
I've split my database into a front- and back-end part.
Since I did that I get an error message.
Explanation of the code :
every database user has on his pc a configfile with his/her idnumber. This idnumber will be compared with a number out of the table "gebruikers" column "IdNr".

The code:

Open "P:\TRACE.CFG" For Input As #1
Input #1, userID
Close #1

usertype = "kijker"
Set tdf = dbHuidig.TableDefs("Gebruikers")
Set rstReport = tdf.OpenRecordset()
-> rstReport.Index = "IDnr"
(->) rstReport.Seek "=", userID
If (rstReport.NoMatch) Then
usertype = "No Access"
MsgBox (" No Access!!!")
DoCmd.Close
Else
usertype = rstReport!user_type
username = rstReport!Name
End If

Error consist at the arrow. Error 3251: This operation is not available for this type of object.
Connection to the tables are OK.The table "gebruikers" will be opened.

Before splitting the database it worked well !!!
What's going on here ?
 
The .Seek method (utilizing the .Index property) is usually only available on native (not linked) tables, use .findfirst in stead:

[tt]Set rstReport = tdf.OpenRecordset()
rstReport.findfirst "UserIdField=" & userID
If (rstReport.NoMatch) Then[/tt]

- add single quotes around the criterion, should userID be text.

Roy-Vidar
 
Thanx a lot,
you did it again !!! it works !!!

you're a genius
 
You can perform a seek on a Linked table using this code that I found out on the net

Public Function OpenForSeek(TableName As String) As Recordset
' Assume MS-ACCESS table
Set OpenForSeek = DBEngine.Workspaces(0).OpenDatabase(Mid(CurrentDb().TableDefs(TableName).Connect, 11), False, False, "").OpenRecordset(TableName, dbOpenTable)
End Function
'************ Code End ***************



then to call it

Dim rst as DAO.Recordset
Set rst = OpenForSeek("tblWSFRecords")

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top