SteveMac32
Programmer
Hi all
Does anyone out there have any idea on how to get the The KeyPress event to trap the Tab key.
I have to write a routine to block the input of certain characters due to the fact that these characters are causing errors when exporting the report into excel.
I can trap all except the tab key I know it is considered a special key by the operating system, and gets used before being passed on to the VB event handlers in order to do form navigation.
Know any way round this?
keypreview property set to true
Private Sub txtComplaint_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKeyReturn, vbKeyTab
'cancels out the keystroke
KeyAscii = 0
Beep
Case 34
KeyAscii = 0
End Select
End Sub
Thanks
Does anyone out there have any idea on how to get the The KeyPress event to trap the Tab key.
I have to write a routine to block the input of certain characters due to the fact that these characters are causing errors when exporting the report into excel.
I can trap all except the tab key I know it is considered a special key by the operating system, and gets used before being passed on to the VB event handlers in order to do form navigation.
Know any way round this?
keypreview property set to true
Private Sub txtComplaint_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKeyReturn, vbKeyTab
'cancels out the keystroke
KeyAscii = 0
Beep
Case 34
KeyAscii = 0
End Select
End Sub
Thanks