Whick key event is preferable, Up, Down or Press

  • Thread starter Thread starter Len B
  • Start date Start date
L

Len B

I have a text field on a form which has a Double-Click event.
I would prefer to have the same code fire when I press F2 (say)
in that field. That way I get to keep my hands on the keyboard
instead of having to grab for the rodent.

Is this feasible for the OnKey events? Which is better? Where
can I find the KeyAscii values of FKeys. Any gotchas to avoid?

TIA
 
On Thu, 30 Jul 2009 22:21:51 +1000, "Len B"

Yes.
The KeyDown event.
The help file page on the KeyDown event (vbKeyF2).
No.

-Tom.
Microsoft Access MVP
 
"rodent" - never heard it refered to with that derogatory phrase, but I like
it. I too like to design my applications to allow for as little mouse use as
possible. As an example, I frequently use the F12 as a substitute for a
right click, so if I have a custom popup menu (as I do for all textboxes), I
check for the F12 key and if it is encountered, I popup my text menu.

Only thing you need to remember is to set the KeyCode to 0 if it is a
function key, so that it won't actually get passed to the textbox.
 
Thanks Tom.
Thanks Dale. You like "rodent". Its yours. You have me curious though. What
sort of info
do you popup on (all) textboxes?

--
Len
______________________________________________________
remove nothing for valid email address.
| "rodent" - never heard it refered to with that derogatory phrase, but I
like
| it. I too like to design my applications to allow for as little mouse use
as
| possible. As an example, I frequently use the F12 as a substitute for a
| right click, so if I have a custom popup menu (as I do for all textboxes),
I
| check for the F12 key and if it is encountered, I popup my text menu.
|
| Only thing you need to remember is to set the KeyCode to 0 if it is a
| function key, so that it won't actually get passed to the textbox.
|
| ----
| HTH
| Dale
|
|
|
| "Tom van Stiphout" wrote:
|
| > On Thu, 30 Jul 2009 22:21:51 +1000, "Len B"
| >
| > Yes.
| > The KeyDown event.
| > The help file page on the KeyDown event (vbKeyF2).
| > No.
| >
| > -Tom.
| > Microsoft Access MVP
| >
| >
| > >I have a text field on a form which has a Double-Click event.
| > >I would prefer to have the same code fire when I press F2 (say)
| > >in that field. That way I get to keep my hands on the keyboard
| > >instead of having to grab for the rodent.
| > >
| > >Is this feasible for the OnKey events? Which is better? Where
| > >can I find the KeyAscii values of FKeys. Any gotchas to avoid?
| > >
| > >TIA
| >
 
Len,

I generally disable the shortcut menus on my forms. Then, I have a set of
custom popup menus that I use throughout in my applications. The one I use
for textboxes (on forms) includes (Copy, Paste, SpellCheck, and Find). I
usually hide the find option, unless I want to use that field as a way for my
users to find a record with a particular value (Last_Name, Phone #, ...).

This requires a little bit of additional code, but I have that built into a
Template form that I use almost every time I create a new form, so there is
no additional work required. To activate the popups, I either use the
MouseDown (and check for the right mouse button), or the KeyDown (and check
for F12).
 
Back
Top