Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. Private Sub Login_txt_Click()
  4. If IsNull(Me.txtLoginID) Then
  5.     MsgBox "Please enter LoginID", vbInformation, "LoginID Required"
  6.     Me.txtLoginID.SetFocus
  7. ElseIf IsNull(Me.txtPassword) Then
  8.     MsgBox "Please enter password", vbInformation, "Password Required"
  9.     Me.txtPassword.SetFocus
  10. Else
  11.     If (IsNull(DLookup("UserName", "Users", "UserName='" & Me.txtLoginID.Value & "'"))) Or _
  12.     (IsNull(DLookup("password", "Users", "Password='" & Me.txtPassword.Value & "'"))) Then
  13.     Else
  14.         MsgBox "LoginID and Password correct"
  15.         DoCmd.OpenForm "mainmenu"
  16.     End If
  17.     If (IsNull(DLookup("UserName", "Users", "UserName ='" & UserName.Value & "'And Password ='" & Password.Value & "'"))) Then
  18.         MsgBox "Incorrect LoginID or Password" 'If the inputs are incorrect or null this message is displayed'
  19.    Else
  20.         UserLevel = DLookup("UserLevel", "Users", "UserName ='" & UserName.Value & "'") 'Setting the UserLevel Variable to the column in the login table'
  21.        DoCmd.Close 'Closing the login windows'
  22.            If UserLevel = "Assessor" Then 'Checking if the User's level is assessor'
  23.                DoCmd.OpenReport "CourseDetails", acViewPreview 'Opening and displaying the CourseDetails'
  24.                DoCmd.Maximize
  25.             ElseIf UserLevel = "Administrator" Then
  26.                 DoCmd.OpenForm "Main Menu"
  27.                 DoCmd.Maximize
  28.             Else
  29.                 DoCmd.OpenForm "Main Menu"
  30.                 DoCmd.Maximize
  31.         End If
  32.     End If
  33. End If
  34. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement