You are on page 1of 1

Dim username As String

Dim password As String

Private Sub cmdLogin_Click()
username = "admin"
password = "admin"

If txtun.Text = username Then
If txtpw.Text = password Then
MsgBox "Username and Password Accepted!", vbInformation, "Login"
ElseIf txtun.Text = "" Then
MsgBox "Need a value for username", vbInformation, "Error"
txtun.SetFocus
ElseIf txtpw.Text = "" Then
MsgBox "Need a value for password", vbInformation, "Error"
txtpw.SetFocus
ElseIf txtpw.Text = "" And txtun.Text = "" Then
MsgBox "Need a value for the textboxes", vbInformation, "Error"
txtun.SetFocus
End If
Else
MsgBox "Username and Password does not match", vbInformation, "Error"
txtun.Text = ""
txtpw.Text = ""
txtun.SetFocus
lblcounter.Caption = Val(lblcounter.Caption) - 1
If lblcounter.Caption = "0" Then
End
End If
End If
End Sub

Private Sub txtpw_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call cmdLogin_Click
Else
End If
End Sub

Private Sub txtun_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call cmdLogin_Click
Else
End If
End Sub