Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Compare Database
- Private Sub cboUser_AfterUpdate()
- Me.txtPassword.SetFocus
- End Sub
- Private Sub btnLogin_Click()
- If IsNull(Me.cboUser) Or Me.cboUser = "" Then
- MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
- Me.cboUser.SetFocus
- Exit Sub
- End If
- If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
- MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
- Me.txtPassword.SetFocus
- Exit Sub
- End If
- If Me.txtPassword.Value = DLookup("Password", "Users", _
- "[Users]=" & Me.cboUser.Value) Then
- lngMyEmpID = Me.cboUser.Value
- Else
- MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
- "Invalid Entry!"
- Me.txtPassword.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 admin.", _
- vbCritical, "Restricted Access!"
- Application.Quit
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement