R
Ray
I have managed to get a password function working using the code on this
Microsoft page.
http://support.microsoft.com/kb/209871
My code works perfectly if I create the table tblPassword within the active
..mdb file.
However, if I put the tblPassword table in another mdb and link it I get an
Error 3219 Invalid Operation message.
I am thinking towards the recordset part of the code which is as follows:
DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit
Any help appreciated.
Thanks.
Ray
Microsoft page.
http://support.microsoft.com/kb/209871
My code works perfectly if I create the table tblPassword within the active
..mdb file.
However, if I put the tblPassword table in another mdb and link it I get an
Error 3219 Invalid Operation message.
I am thinking towards the recordset part of the code which is as follows:
DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit
Any help appreciated.
Thanks.
Ray