i would be very grateful if any body could help me out with this problem as it has been boggling my brains for the last week!
i am only a beginner, but very keen to learn.
Scenario..
i am working on a project for an assignment which is for A- level, the assignment is fairly large but am having trouble with the first stage.
i have split the program into different forms, so am working on each stage individually, then will connect together using global variables where needed.
Problem..
The first stage is a password verification, there are five companies each with a specific customer code and a password. If the password is incorrect i need the program to loop three times ( then an error message to appear at the fourth error of login ie..program is terminated) if the password and code is correct then (form2.show)
The coding i have..
Private Sub Form_Load()
Label1.Caption = "UserName"
Label2.Caption = "Password"
Command1.Caption = "Login"
Command2.Caption = "Cancel"
LoginSucceeded = False
pass = 0
End Sub
Sub Command1_Click()
Dim customer As String
Dim password As String
Dim pass As Integer
pass = 1
If customer = "10010" And password = "january" Then form2.Show
If customer = "10011" And password = "february" Then form2.Show
If customer = "10012" And password = "march" Then form2.Show
If customer = "10013" And password = "april" Then form2.Show
If customer = "10014" And password = "may" Then form2.Show
Do While pass <= 3
If Text2.Text = "Password" Then
LoginSucceeded = True
pass = 0
Else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
pass = pass + 1
If pass > 3 Then MsgBox "Alert Intruded Intruder"
End If
Loop
End Sub
The main error at debug is the section...txtPassword.SetFocus(this is shown red in the coding) i think i am almost there but may need another variable or object of some kind..
Please if you can help..i will buy you a beer!
thanks.
i am only a beginner, but very keen to learn.
Scenario..
i am working on a project for an assignment which is for A- level, the assignment is fairly large but am having trouble with the first stage.
i have split the program into different forms, so am working on each stage individually, then will connect together using global variables where needed.
Problem..
The first stage is a password verification, there are five companies each with a specific customer code and a password. If the password is incorrect i need the program to loop three times ( then an error message to appear at the fourth error of login ie..program is terminated) if the password and code is correct then (form2.show)
The coding i have..
Private Sub Form_Load()
Label1.Caption = "UserName"
Label2.Caption = "Password"
Command1.Caption = "Login"
Command2.Caption = "Cancel"
LoginSucceeded = False
pass = 0
End Sub
Sub Command1_Click()
Dim customer As String
Dim password As String
Dim pass As Integer
pass = 1
If customer = "10010" And password = "january" Then form2.Show
If customer = "10011" And password = "february" Then form2.Show
If customer = "10012" And password = "march" Then form2.Show
If customer = "10013" And password = "april" Then form2.Show
If customer = "10014" And password = "may" Then form2.Show
Do While pass <= 3
If Text2.Text = "Password" Then
LoginSucceeded = True
pass = 0
Else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
pass = pass + 1
If pass > 3 Then MsgBox "Alert Intruded Intruder"
End If
Loop
End Sub
The main error at debug is the section...txtPassword.SetFocus(this is shown red in the coding) i think i am almost there but may need another variable or object of some kind..
Please if you can help..i will buy you a beer!
thanks.