loop and refresh question - TechRepublic
General discussion
November 25, 2000 at 11:58 AM
dennisbv

loop and refresh question

by dennisbv . Updated 25 years, 6 months ago

I am working on a login program and I have to areas that I am asking assitance with. I am trying to get a loop to work so the user will have only three tries to login. Second I want the form to refresh, If I enter in false info. The code clears the text box but if I enter in correct info on the second try nothing happens below is my code
thanks Dennis

Private Sub cmdLogin_Click()

Dim intTry As Integer

intTry = intTry + 1

Me.adoLogin.Recordset.Find “UserId='” & txtUserId.Text & “‘” ‘finds the first record

If intTry > 3 Then
End
End If

If txtPassword.Text = lblPass.Caption Then ‘check the password
If txtUserId.Text = “Administrator” Then ‘is Administratorentered

frmLogin.Caption = ” Welcome to my NIGHTMARE” ‘ change the form caption
Call Load(frmAdmin) ‘load the admin form
frmAdmin.Show ‘make the form admin visable
Call Unload(frmLogin) ‘unload the login form

ElseIf txtPassword.Text = lblPass.Caption Then ‘checks the password

frmLogin.Caption = ” Welcome to my NIGHTMARE” ‘change the caption
Me.Hide ‘hides the login form
Call Load(frmWelcome) ‘loads the welcome form
Call Unload(frmLogin)
frmWelcome.Show

Else
frmLogin.Caption = “Sorry Charlie, not today” ‘caption for unsuccessful attempt

End If

End If

lblTest.Caption = intTry

Me.txtUserId= ” ” ‘Clears the text box
Me.txtPassword = ” ” ‘Clears the text box

End Sub

This discussion is locked

All Comments