External connection to back-end database

S

Serena

Hi there

I have an existing database that I inherited which
contains a lump of code (I suspect) copied from Northwind -
code below. I need to split the database so that in the
future I can make front-end changes easily but the code
now falls over at the Set MyLogin statement with run-time
error 3251. Apparently (KB287638) you can't use SEEK
directly on linked tables but instead need to open an
external connection to the back-end and then use SEEK
directly on the table - can someone please tell me how I
do this 'external connection'.

Any assistance would be much appreciated.

Cheers
Serena

Private Sub LogButton_Click()
Dim LogData As Database
Dim stDocName As String
Dim stLinkCriteria As String
Dim MyLogin As Recordset
Dim UserResponce
Dim MyControl As Control

Set LogData = CurrentDb
Set MyLogin = LogData.OpenRecordset("Login",
dbOpenTable)


With MyLogin
.Index = "PrimaryKey"
MyLogin.Seek "=", Me![LoginID]
If MyLogin.NoMatch Then
Set MyControl = Me![LoginID]
UserResponce = MsgBox("Login ID not found",
vbExclamation, "Login Validation")
MyControl.SetFocus
Else
If Me![PassWord] = MyLogin![PassWord] Then
If MyLogin![Supervisor] = True Then
stDocName = "Switchboard1"
Else
stDocName = "Switchboard2"
End If
 
S

Serena

On second thoughts, the login and switchboard tables
shouldn't be in the back-end anyway since they're not
actually 'data' tables, I'll copy them back into the front-
end and then I won't have the problem !

Feel free to still respond if you have a better answer :)
 
T

Tim Ferguson

Set MyLogin = LogData.OpenRecordset( _
"Login", dbOpenTable)

You cannot open a Table type recordset on a linked table: change this to an
open dbDynaset.

B Wishes


Tim F
 

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