Advertisement
Guest User

Untitled

a guest
Feb 11th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Compare Database
  2.  
  3. Private Sub Command1_Click()
  4. Dim UserLevel As String
  5. If IsNull(Me.txtLoginID) Then
  6.     MsgBox "Please enter LoginID", vbInformation, "LoginID required"
  7.     Me.txtLoginID.SetFocus
  8. ElseIf IsNull(Me.txtPassword) Then
  9.     MsgBox "Please enter password", vbInformation, "Password Required"
  10.     Me.txtPassword.SetFocus
  11. Else
  12.     'process the job
  13.   If (IsNull(DLookup("UserName", "Users", "UserName ='" & Me.txtLoginID.Value & "'"))) Or _
  14.     (IsNull(DLookup("Password", "Users", "Password ='" & Me.txtPassword.Value & "'"))) Then
  15.         MsgBox "Incorrect LoginID or Password"
  16.     Else
  17.         DoCmd.Close acForm, "Login"
  18.         UserLevel = DLookup("UserLevel", "Users", "UserName ='" & UserName.Value & "'")
  19.         DoCmd.Close 'Closing the login windows'
  20.            If UserLevel = "Assessor" Then 'Checking if the User's level is assessor'
  21.                DoCmd.OpenReport "CourseDetails", acViewPreview 'Opening and displaying the CourseDetails'
  22.                DoCmd.Maximize
  23.             ElseIf UserLevel = "Owner" Then
  24.                 DoCmd.OpenForm "mainmenu"
  25.                 DoCmd.Maximize
  26.             ElseIf UserLevel = "Administrator" Then
  27.                 DoCmd.OpenForm "mainmenu"
  28.                 DoCmd.Maximize
  29.             ElseIf UserLevel = "Guest" Then
  30.                 DoCmd.OpenForm "mainmenu"
  31.                 DoCmd.Maximize
  32.             Else
  33.                 DoCmd.OpenForm "mainmenu"
  34.                 DoCmd.Maximize
  35.             End If
  36.     End If
  37. End If
  38.  
  39.  
  40.  
  41. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement