How would I edit this so if a password was entered wrong three times it'll exit the program?
Thanks for any help.
VB Code:
Private Sub cmdLogin_Click() Dim PassRS As Recordset Set PassRS = Db.OpenRecordset("Login") While Not PassRS.EOF And Not LoginOK If (PassRS.Fields("password").Value = txtPassword.Text) And (PassRS.Fields("Username").Value = cboLogin.Text) Then LoginOK = True CurrentUser = PassRS("Username").Value Else PassRS.MoveNext End If Wend If LoginOK Then Beep frmIntro.Show frmPassword.Hide txtPassword = "" LoginOK = False Else Response = MsgBox("Incorrect password", vbRetryCancel + vbCritical, "Access Denied") If Response = vbRetry Then txtPassword.SetFocus txtPassword.SelStart = 0 txtPassword.SelLength = Len(txtPassword.Text) End If End If End Sub




Reply With Quote