Run-Time Error 3219

G

Guest

I found a KB article 208379 on this error, but don't understand how I need to change my code to fix it. I didn't have a problem until I split my database. Below is the problem code. Can someone show me how to fix this?

Thank you in advance for your help, Pam

-------------------------

Private Sub Form_Open(Cancel As Integer)
Dim Hold As Variant
Dim tmpKey As Long
Dim I As Integer
Dim rs As DAO.Recordset
Dim db As DAO.Database

On Error GoTo Error_Handler
' Prompt the user for the Password.
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
End If
End If
rs.Close
db.Close
Exit Sub

Error_Handler:
MsgBox err.Description, vbOKOnly, "Error #" & err.Number
Exit Sub
End Sub

_____________________-
 
P

Peter Hoyle

I found a KB article 208379 on this error, but don't understand how I need
to change my code to fix it. I didn't have a problem until I split my
database. Below is the problem code. Can someone show me how to fix this?
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)

Looking at KB208379 it seems like the above line is causing the problem.

Try

Set rs = db.OpenRecordset("tblPassword")
Or
Set rs = db.OpenRecordset("tblPassword", dbOpenDynaset)


Cheers,
Peter
 

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