Researcher
I.T. Veteran
- Local time
- Today, 11:17
- Joined
- Oct 11, 2006
- Messages
- 42
Can someone please help me with this syntax issue?
I am using the following code to check usernames and passwords on a form,
and am getting the following error:
Application-Defined or Object-Defined error
My Table Name is tblUsers and the field names are UserName and Password
The form name is: SignIn
Here is my code:
Private Sub SignIn_Click()
Dim User As String
Dim pass As String
User = Nz(DLookup("[UserName]", "tblUsers", "[UserName]= '" & Forms!SignIn.txtusername & "'"), "")
pass = Nz(DLookup("[Password]", "tblUsers", "[Password]= '" & Forms!SignIn.txtusername & "'"), "")
If User = Forms!SignIn!UserName Then
DoCmd.OpenForm "frmSignIn", acNormal
DoCmd.Close acForm, "SignIn", acSaveNo
Else
MsgBox "Invalid Username/Password combination, please try again"
End If
End Sub
Thank You for any help...
I am using the following code to check usernames and passwords on a form,
and am getting the following error:
Application-Defined or Object-Defined error
My Table Name is tblUsers and the field names are UserName and Password
The form name is: SignIn
Here is my code:
Private Sub SignIn_Click()
Dim User As String
Dim pass As String
User = Nz(DLookup("[UserName]", "tblUsers", "[UserName]= '" & Forms!SignIn.txtusername & "'"), "")
pass = Nz(DLookup("[Password]", "tblUsers", "[Password]= '" & Forms!SignIn.txtusername & "'"), "")
If User = Forms!SignIn!UserName Then
DoCmd.OpenForm "frmSignIn", acNormal
DoCmd.Close acForm, "SignIn", acSaveNo
Else
MsgBox "Invalid Username/Password combination, please try again"
End If
End Sub
Thank You for any help...