Clayhead22
Registered User.
- Local time
- Today, 05:59
- Joined
- Feb 22, 2015
- Messages
- 36
Hi. I have recently started a project and become stuck already. I have a login form created that works (code below). What i want to do is allow access to the users of 1-7 in table (level of access) which will determine which page they view after logging in. IE if the have Access in table "Users" as "1" then when they log in the will see a form thats called L1. Same with 2,3,4,5,6 & 7.
Hope you can help.
Hope you can help.
Code:
Private Sub LoginButton_Click()
If IsNull(Me.LoginUsernameText) Then
MsgBox "Please Enter Username", vbInformation, "Username Required"
Me.LoginUsernameText.SetFocus
ElseIf IsNull(Me.LoginPasswordText) Then
MsgBox "Please Enter Password", vbInformation, "Password Required"
Me.LoginPasswordText.SetFocus
Else
If (IsNull(DLookup("[Username]", "Users", "[Username] ='" & Me.LoginUsernameText.Value & "' And password = '" & Me.LoginPasswordText.Value & "'"))) Then
MsgBox "Incorrect Username or Password"
Else
MsgBox "Password accepted! Welcome!"
DoCmd.OpenForm "Interface"
End If
End If
End Sub