Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbKeyReturn problem

Status
Not open for further replies.

jseva

IS-IT--Management
Mar 26, 2001
26
US
My vbKeyReturn key when pressed is not invoking the call statement below. If I move cmdTotal_Click under vbKeyBack, pressing backspace will invoke the call. It seems that the return key has a mind of its own. Please help.

Select Case KeyCode
Case Is = vbKeyBack
Call cmdBack_Click
Case Is = vbKeyReturn
Call cmdTotal_Click
End Select
 
Hi,
It didn't seem to behave incorrectly for me. What is the value of KeyCode when you press the <ENTER> key?

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyBack
MsgBox &quot;backspace pressed&quot;
Case vbKeyReturn
MsgBox &quot;enter key pressed&quot;
Case Else
MsgBox &quot;Key=&quot; & KeyCode, , Shift
End Select
End Sub

Have a good one!
BK
 
My form has a lot of command buttons. If I didn't have any, using the Form_Keypress works for me too. However, with command buttons, it doesn't. You have to hit shift+enter for it to work. Weird!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top