Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Compare Database
- Private intLogonAttempts As Integer
- Private Sub cmdLogin_Click()
- If IsNull(Me.cboUsername) Or Me.cboUsername = "" Then
- MsgBox "You must enter a User Group.", vbOKOnly, "Required Username"
- Me.cboUsername.SetFocus
- Exit Sub
- End If
- If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
- MsgBox "You must enter a Password.", vbOKOnly, "Enter Password"
- Me.txtPassword.SetFocus
- Exit Sub
- End If
- 'login if statements
- If Me.txtPassword.Value = DLookup("Password", "tblSTAFF", "[ID]=" & Me.cboUsername.Value) Then
- ID = Me.cboUsername.Value
- DoCmd.Close acForm, "frmStaffLogin", acSaveNo
- If ID = 1 Then
- DoCmd.OpenForm "frmSubTeach"
- ElseIf ID = 2 Then
- DoCmd.OpenForm "frmFormTeach"
- ElseIf ID = 3 Then
- DoCmd.OpenForm "frmHeadOfYear"
- End If
- Else
- MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Incorrect Password."
- Me.txtPassword.SetFocus
- End If
- 'attempts counter
- intLogonAttempts = intLogonAttempts + 1
- If intLogonAttempts > 3 Then
- MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
- End If
- End Sub
Add Comment
Please, Sign In to add comment