Sie sind auf Seite 1von 1

Option Compare Database

Private Sub Command1_Click()


Dim UserLevel As String

If IsNull(Me.txtUsername) Then
MsgBox "Please enter Username", vbInformation, " Username Requierd"

ElseIf IsNull(Me.txtPassword) Then


MsgBox "Please enter Password", vbInformation, " Password Requierd"

Else

If Nz(DLookup("Password", "tblUser", "Username = '" & Me.txtUsername & "'"),


"Password") = Me.txtPassword Then
UserLevel = Nz(DLookup("Seclevel", "tblUser", "Username = '" &
Me.txtUsername & "'"))

If UserLevel = "Admin" Then


DoCmd.Close
DoCmd.OpenForm "NavigationForm"
MsgBox "Welcome back, your security level is Admin", vbInformation, "
Access Allowed"

ElseIf UserLevel = "Editor" Then


DoCmd.Close
DoCmd.OpenForm "NavigationForm"
Form_NavigationForm.NavigationControl.Enabled = False
MsgBox "Welcome back, your security level is Editor",
vbInformation, " Access Allowed"

ElseIf UserLevel = "User" Then


DoCmd.Close
DoCmd.OpenForm "NavigationForm"
Form_NavigationForm.NavigationControl.Enabled = False
Form_NavigationForm.NavigationInfo.Enabled = False
Form_NavigationForm.AllowEdits = False
MsgBox "Welcome back, your security level is User", vbInformation, "
Access Allowed"
End If

Else
MsgBox "Sorry .. Wrong Username or Password", vbExclamation, "Access
Denied"
End If
End If
End Sub

Das könnte Ihnen auch gefallen