Split Database Recordset.seek and index problem

yaskhan

New member
Local time
Today, 00:49
Joined
May 16, 2009
Messages
1
i used Split database and seperated my forms and tables succesfully but after that my code is not working and giving me error in .index and .seek line, please reply by sample code how can i used it after database split, for your i also tried dynaset but it's not working either.
Your help will be appreciated.
Thanks

Private Sub Button14_Click()

Dim MyDB As Database, MyTable As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MyTable = MyDB.OpenRecordset("Password", DB_OPEN_TABLE)
MyTable.Index = "PrimaryKey"
MyTable.Seek "=", [Forms]![Password]![NameBox]
If MyTable.NoMatch Then
[Forms]![Password].NameBox = ""
[Forms]![Password].Pass = ""
DoCmd.GoToControl "NameBox"
End If
 
ok let me take another wild guess , you splited your database and then you are now using one side as gui and the other as db , and now you are trying to run this code from gui side on a linked table generated by split wizard .
interesting enough dao wont function that way , dao cant handle linked tables but rather "Set MyDB = DBEngine.Workspaces(0).Databases(0)" has to inflict real location of db with tables .. you see Workspaces(0) = current folder , and Databases(0) is current database , now i dont know your setting but maybe "DBEngine.Workspaces(0).Databases(1)" would help assuming that you have only these two databases present in current folder .
Finaly why all that code to authenticate a user name and password (in a wierd way) ??
why dont you use Dlookup function that works seemlessly with linked tables when it comes to a single value lookup .

P.S
I'm laughing my guts out of all the assumptions i made on this one :D
 
Directly from VBA Help:
You can't use the Seek method on a linked table because you can't open linked tables as table-type Recordset objects. However, if you use the OpenDatabase method to directly open an installable ISAM (non-ODBC) database, you can use Seek on tables in that database.
 
or you can use find type operations

findfirst, findnext etc

not quite as quick, but if you use a sorted query as the recordset source, it will be still be adequate.
 

Users who are viewing this thread

Back
Top Bottom