Hi
I tried to detect the Tab key with the keypress event (keyascii) and the keyup event (keycode) but it doesnt' detect it.
How can I see that this key was pressed.
I don't want to use the lost focus event.
Thanks in avance
You will need to set the forms keypreview property to true and set the tabstop property of all controls to false.
Why are you trying to catch the tab key? If it is to check if entered data is valid then try using the validate event. It is the last event fired when the control loses focus and will allow you to cancel (set cancel =true) the validation and have that control retain focus. See thread222-482338.
Take Care,
zemp
"Show me someone with both feet on the ground and I will show you someone who can't put their pants on."
it's because the user can navigate in the form with the tab key. The lost focus is not the event that i'm locking for because I don't want to do my search when he or she lost the focus on the field but when he or she hit enter or the tab key.
I don't know if this will help but here is some code I use to check for the "enter" key should only need to change a little for tab.
This is in the keypress event
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.