keyboard instead of button

  • Thread starter Thread starter Irene Kral
  • Start date Start date
I

Irene Kral

Hi!

I am working on a form for my work, and i wonder if one cane execute a macro
or a module with a keystroke (e.g. F5) instead of clicking on a button.
Does it need some vb know how?

thnx

Irene
 
Irene,
You can use the Caption property of a button to activate that button, by
using a & in the Name..
That Button can be visible, or invisible on the form.
A button captioned...
&Open Report
will fire when Alt-O is keyed in.

Close &Form
will fire when Alt-F is keyed in.

That button can call an Event Procedure, or a Macro... in it's Click
event.

Probably best not to use function keys, as often... Access uses them for
functions. F5 on a form, causes the cursor to jump to the navigation pane
(if present).
If you don't want to use the above &X method , you'll need to code a key
trap for whatever key you do choose.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
thank you so much!

:)

irene


Al Campagna said:
Irene,
You can use the Caption property of a button to activate that button,
by using a & in the Name..
That Button can be visible, or invisible on the form.
A button captioned...
&Open Report
will fire when Alt-O is keyed in.

Close &Form
will fire when Alt-F is keyed in.

That button can call an Event Procedure, or a Macro... in it's Click
event.

Probably best not to use function keys, as often... Access uses them
for functions. F5 on a form, causes the cursor to jump to the navigation
pane (if present).
If you don't want to use the above &X method , you'll need to code a
key trap for whatever key you do choose.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Hi!

I am working on a form for my work, and i wonder if one cane execute a macro
or a module with a keystroke (e.g. F5) instead of clicking on a button.
Does it need some vb know how?

Several ways. For one, you can use the Tab key to navigate around a form; each
control has a Tab Order property which controls where you tab to next. You can
rightclick the little square at the upper left intersection of the rulers and
choose Tab Order and set them that way. When you tab to a command button you
can click it by pressing Enter or the spacebar (and you can set the properties
of the button to accept or ignore either).

Or, you can use an often-ignored feature of the Caption property of a button
control: prefix a letter in the control caption with an ampersand "&"
character. It will display with an underline, and pressing that letter while
holding the Alt key will click the button. For example, if you have a close
button with a caption E&xit, the user will see Exit with the "x" underlined,
and typing alt-X will "press" the button.

Finally, you can use the Form's Key Down, Key Up, and Key Press events to trap
keystrokes. See the online help for these event properties.
 
Back
Top