Ryanr
01-18-2010, 08:38 AM
Hello there!
I am currently trying to create a simple login screen for my database. I have a table with the login details - Username, password and access level - and it works fine, except DLookup isn't working for my passwords. It simply can't find anything. When I take out the password from the login form, both the username and the access level sections work as they should
'Check username'
Check = DCount("[Username]", "Tbl_Login", "Username = Forms!Login!Text3")
If Check = 1 Then
checklogin = 1
Else
checklogin = 0
MsgBox ("NAMEWRONG")
End If
'check password'
If checklogin = 1 Then PWcheck = DCount("[Password]", "Tbl_Login", "username = Forms!Login!Text3")
If UCase(PWcheck) = UCase(Forms!Login!Text5) Then
checklogin = 2
Else
checklogin = 0
MsgBox ("PASSWRONG")
End If
If checklogin = 0 Then
MsgBox ("Login failed. If problems persist, contact IT helpdesk")
Exit Sub
End If
'***Check accesslevel***''
If checklogin = 2 Then accesslevel = DCount("[Access level]", "Tbl_Login", "Username=Forms!Login!Text3")
If accesslevel = 0 Then
DoCmd.Close
DoCmd.OpenForm ("OPENING_FORM")
Form_OPENING_FORM.Command1.Visible = False
End If
If accesslevel = 1 Then
DoCmd.Close
DoCmd.OpenForm ("OPENING_FORM")
End If
End Sub
Please can anyone shed any light on this?
I am currently trying to create a simple login screen for my database. I have a table with the login details - Username, password and access level - and it works fine, except DLookup isn't working for my passwords. It simply can't find anything. When I take out the password from the login form, both the username and the access level sections work as they should
'Check username'
Check = DCount("[Username]", "Tbl_Login", "Username = Forms!Login!Text3")
If Check = 1 Then
checklogin = 1
Else
checklogin = 0
MsgBox ("NAMEWRONG")
End If
'check password'
If checklogin = 1 Then PWcheck = DCount("[Password]", "Tbl_Login", "username = Forms!Login!Text3")
If UCase(PWcheck) = UCase(Forms!Login!Text5) Then
checklogin = 2
Else
checklogin = 0
MsgBox ("PASSWRONG")
End If
If checklogin = 0 Then
MsgBox ("Login failed. If problems persist, contact IT helpdesk")
Exit Sub
End If
'***Check accesslevel***''
If checklogin = 2 Then accesslevel = DCount("[Access level]", "Tbl_Login", "Username=Forms!Login!Text3")
If accesslevel = 0 Then
DoCmd.Close
DoCmd.OpenForm ("OPENING_FORM")
Form_OPENING_FORM.Command1.Visible = False
End If
If accesslevel = 1 Then
DoCmd.Close
DoCmd.OpenForm ("OPENING_FORM")
End If
End Sub
Please can anyone shed any light on this?