Still trying to learn VB i cant get my Login to work.
The table i have my user names and passwords stored on is called "User Name"
The user name column is "User Name" and the Password is "password"
The Login Form Name is "Login Screen" one drop down box with the user names in it named "User Names". another empty text Box Named "password"
my VB code for the login button as follows:
i know the statement is wrong, do i have to set focus's or something? Im not too Fammilar with DLookup eather i made the code soley on the help file can someone gimmie a rundown on the Dlookup Function!
Please HELP!

The table i have my user names and passwords stored on is called "User Name"
The user name column is "User Name" and the Password is "password"
The Login Form Name is "Login Screen" one drop down box with the user names in it named "User Names". another empty text Box Named "password"
my VB code for the login button as follows:
Code:
Private Sub Command27_Click()
If Me.Password.Value = DLookup("[Password]", "User Name", [User Name] = Me.User_name.Value) Then
DoCmd.Close acForm, "Login Screen", acSaveNo
DoCmd.OpenForm "Switchboard"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.Password.SetFocus
End If
LogonAttempts = LogonAttempts + 1
If LogonAttempts > 3 Then
MsgBox "You do not have permission to access this database.Please contact your database administrator."
Application.Quit
End If
End Sub
i know the statement is wrong, do i have to set focus's or something? Im not too Fammilar with DLookup eather i made the code soley on the help file can someone gimmie a rundown on the Dlookup Function!
Please HELP!