Problem

jamesT

Registered User.
Local time
Today, 13:54
Joined
Mar 5, 2003
Messages
16
i use a DLookup on a form to check whether a username and password are valid, it worins fins until you add or delete a user.

It will not accept the new data.

does anybody know why????
 
this is what I use (adapted from a previous post)

rivate Sub CmdOk_Click()

On Error GoTo txtPassword_AfterUpdateError
'Sign into program - ask for Users name
If CNStr([txtUserID]) = "" Then
MsgBox "Please Enter Your User Name"
Me![txtUserID].SetFocus
Exit Sub
End If

'validates User Name and Password
Me![txtCheckUserID] = DLookup("[User ID]", "tblPassword", "[Password] = Forms![frm Password]![txtPassword]")
Me![txtCheckPassword] = DLookup("[Password]", "tblPassword", "[Password] = Forms![frm Password]![txtPassword]")

If Me![txtCheckUserID] <> Me![txtUserID] Then
MsgBox "Not A Valid User Name" 'not a valid User Name returns to Name input field
Me![txtUserID] = ""
Me![txtPassword] = ""
Me![txtUserID].SetFocus
Exit Sub
End If

If IsNull(Me![txtCheckPassword]) Then
MsgBox "Not A Valid Password" 'not a valid Password returns to Password input field
Me![txtPassword] = ""
Me![txtUserID].SetFocus
Me![txtPassword].SetFocus
Exit Sub
Else
vLevel = DLookup("[Authorization]", "tblPassword", "[Password] = Forms![frm Password]![txtPassword]")
vUserID = DLookup("[User ID]", "tblPassword", "[Password] = Forms![frm Password]![txtPassword]")
End If

Dim frm As String
frm = "frmMainMenu"
DoCmd.OpenForm frm



Me.Visible = False

txtPassword_AfterUpdateDone:
Exit Sub

txtPassword_AfterUpdateError:
MsgBox Err.Description
Resume txtPassword_AfterUpdateDone

End Sub
 

Users who are viewing this thread

Back
Top Bottom