im making a simple login form,
i want to use the keypress,
when i enter my username and password and hit the enterkey,
the form2 will appear and also the msgbox if the username and password,is wrong.this what i have,but is not working,pls help what is worng or what should i do...tanx
Code:Private Sub Command1_Click() If Text1.Text = "aaa" And Text2.Text = "111" Then Form2.Show Unload Me Else MsgBox "wrong" Text1.SetFocus Text1.Text = "" Text2.Text = "" End If Form1.KeyPreview = True End Sub Private Sub Command1_KeyPress(KeyAscii As Integer) Select Case KeyCode Case vbKey13 Call Command1_Click End Select End Sub




Reply With Quote