|
-
Access 2003 Login with Mutiple switchboards
I have an access database (adp) with an login form. The form works great, logs in and then displays the default switchboard. I need it to baised on a value (numerical) to display the proper switchboard. The table that holds the user information has an UserID,Password, and DBAccess field. The dbaccess field holds the value (1,2,3,4,5). Ive created forms that i want to display after the login...eg bob is level 2 so level 2 form displays.
heres the code to the current login, need help adding in the next step to display the proper switchboard form.
Thanks.
Private Sub cmdLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.UserID) Or Me.UserID = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.UserID.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.LoginPassword) Or Me.LoginPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.LoginPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this matches value chosen in combo box
If Me.LoginPassword.Value = DLookup("EmpPassword", "tblLogin", "EmpLogin='" & Me.UserID.Value & "'") Then
EmpLogin = Me.UserID.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmMainMenu"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.LoginPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|