Hi All,

I have created a simple password scree that validates against 2 fields, User_Name and password. Trouble is it keeps crashing. It appears to begin the login ok and then it all freezes up any ideas appreciated.

Code Below:

Private Sub cmdCheck_Click()

'set up a new recordset
Dim dbPWD As DAO.Database, rsPWD As DAO.Recordset
Dim intResponse As Integer

intResponse = 0

Set dbPWD = CurrentDb
Set rsPWD = dbPWD.OpenRecordset("Select * From tblpwd;", dbOpenDynaset)

'Search and validate
Do While Not rsPWD.EOF

If txtUserName.Value = rsPWD.Fields("User_name") And _
txtPassword.Value = rsPWD.Fields("Password") Then

Form_Startup.Visible = True
Form_pwdAuth.Visible = False

Else
MsgBox ("Invalid Username or password, please try again")
rsPWD.MoveNext
intResponse = intResponse + 1

End If

If intResponse = 3 Then
MsgBox ("You have reached the maximum number of login attempts, please contact an administrator for further assistance.")
'Unload Me
End If

Loop

End Sub