[RESOLVED] Text box cannot used enter
I try to use enter after I type the number value to get the records, While press enter from the keyboad, I got the messagebox Only number is allowed. So I cannot used enter from keyboard
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
'bila type text, kuar mesg box
Select Case KeyAscii ' This case statment check that no text can be entered.
Case vbKeyDelete ' Delete Key
Case vbKeyBack 'Baskspace key
Case 48 To 57 ' Number 0-9
Case Else
MsgBox "Only number is allowed", vbInformation, "KEY ERROR" ' Error message comes up if you enter text.
KeyAscii = 0 ' Cancels Keystroke
End Select
Re: Text box cannot used enter
Add another Select Case branch to that with vbKeyReturn then execute what you want.