Happy New Years to everyone
thanks for the help on my login security form. With all the help and changes i've made I'm now coming up with a Syntax error. This is my code so far.
Private Sub LOGIN_ID_FORM_Click()
Dim userlevel As Integer
Dim Userpassword As String
Dim Userlogin As String
Dim securityLVL As Integer
If IsNull(Me.txtLoginID) Then
MsgBox "Please Enter LoginID", vbInformation, "LoginID Required"
Me.txtLoginID.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "Please Enter Password", vbInformation, "Password Required"
Me.txtPassword.SetFocus
Else
'PROCESS JOB
If _ (this is the section that has a syntax error upto THEN)
( IsNuLL( _
DLookup( "[USERLOGIN]", "Login", "[USERLOGIN]= '" & Me.txtLoginID & "" )) _
OR _
( IsNull( _
DLookup( "[USERPASSWORD]", "Login", "[USERPASSWORD]= '" & Me.txtPassword & "" ))
Then
MsgBox "INVALID LOGIN ID OR PASSWORD"
Else
userlevel = (DLookup("[SecurityLVL]", "Login", "[UserLogin]= " & Me.txtLoginID & ""))
DoCmd.Close
If userlevel = 1 Then
'MsgBox "LOGIN ID AND PASSWORD ARE CORRECT"
DoCmd.OpenForm "ADMIN FORM"
Else
DoCmd.OpenForm "SPLASH PAGE"
End If
End If
End If
End Sub
on everyone's suggestion I changed the And to an OR I just hope when I get this working it will make sure both login and password are correct before going to the right form according to their security level. In case you need to know my table names are:
Login (table name)
field names USERID (auto), USERNAME (short text), USERLOGIN (short text), USERPASSWORD (short text), SecurityLVL (number), SecurityType (short text)
Thank You All for the Help. I'm sure I will have need of all of you when I set up the login tracking Thanks again
thanks for the help on my login security form. With all the help and changes i've made I'm now coming up with a Syntax error. This is my code so far.
Private Sub LOGIN_ID_FORM_Click()
Dim userlevel As Integer
Dim Userpassword As String
Dim Userlogin As String
Dim securityLVL As Integer
If IsNull(Me.txtLoginID) Then
MsgBox "Please Enter LoginID", vbInformation, "LoginID Required"
Me.txtLoginID.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "Please Enter Password", vbInformation, "Password Required"
Me.txtPassword.SetFocus
Else
'PROCESS JOB
If _ (this is the section that has a syntax error upto THEN)
( IsNuLL( _
DLookup( "[USERLOGIN]", "Login", "[USERLOGIN]= '" & Me.txtLoginID & "" )) _
OR _
( IsNull( _
DLookup( "[USERPASSWORD]", "Login", "[USERPASSWORD]= '" & Me.txtPassword & "" ))
Then
MsgBox "INVALID LOGIN ID OR PASSWORD"
Else
userlevel = (DLookup("[SecurityLVL]", "Login", "[UserLogin]= " & Me.txtLoginID & ""))
DoCmd.Close
If userlevel = 1 Then
'MsgBox "LOGIN ID AND PASSWORD ARE CORRECT"
DoCmd.OpenForm "ADMIN FORM"
Else
DoCmd.OpenForm "SPLASH PAGE"
End If
End If
End If
End Sub
on everyone's suggestion I changed the And to an OR I just hope when I get this working it will make sure both login and password are correct before going to the right form according to their security level. In case you need to know my table names are:
Login (table name)
field names USERID (auto), USERNAME (short text), USERLOGIN (short text), USERPASSWORD (short text), SecurityLVL (number), SecurityType (short text)
Thank You All for the Help. I'm sure I will have need of all of you when I set up the login tracking Thanks again
Last edited: