Advertisement
Guest User

Untitled

a guest
Mar 31st, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. Private Sub Command1_Click()
  2. Dim UserLevel As Integer
  3.  
  4. If IsNull(Me.txtUserName) Then
  5. MsgBox "Enter UserName", vbInformation, "UserName Required"
  6. Me.txtUserName.SetFocus
  7. ElseIf IsNull(Me.txtPassword) Then
  8. MsgBox "Enter Password", vbInformation, "Password Required"
  9. Me.txtPassword.SetFocus
  10. Else
  11. 'process the job
  12.  
  13. If (IsNull(DLookup("UserName", "tblUser", "UserName ='" & Me.txtUserName.Value & "'"))) Or _
  14. (IsNull(DLookup("Password", "tblUser", "Password ='" & Me.txtPassword.Value & "'"))) Then
  15. MsgBox "Incorrect UserName or Password"
  16. Else
  17. UserLevel = (DLookup("UserSecurity", "tblUser", "UserName = ' " & Me.txtUserName.Value & "'"))
  18. DoCmd.Close
  19. If UserLevel = 1 Then
  20. 'MsgBox "UserName and Password Correct"
  21. DoCmd.OpenForm "Navigation Form"
  22. Else
  23. DoCmd.OpenForm "Main Menu"
  24. End If
  25. End If
  26. End If
  27. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement