How do you create shortcut keys in code

G

Guest

I am trying to automate the process of having a data entry clerk enter data
into a form and to have her just enter shortcut keys to do tasks like close
the form or to open specifc tabs.

How would I code this into the page so that she could just do simple key
presses to move around the forms?
 
P

Perry

No need for programming.

Indicate in the Caption property of the controls, which lettre you want
the shortcut key to react on by inserting "&" sign

Exmple
me.Command1.Caption = "O&K"
will have K as the shortcut key

or

me.Command1.Caption = "&OK"
will have O as the shortcut key

Krgrds,
Perry
 
P

Perry

Below exmpls smell like coding despite my
intial remark: no coding ..stuff

You can enter the settings in the properties pane.
;-)

Krgrds,
Perry
 
G

Guest

Yup, I got that part. But then in the code on the form how do you get the
button to reconize that it has been pressed via the shortcut keys?

Don't you need to enable keydown and then have the code check to see what
was pressed?

I just do not remember how to code this.
 
P

Perry

You need to recognise the keydown event of controls?
Eventhough I don't like to work with this one, but you can certainly use:
Activecontrol under the Screen object as in:

MsgBox screen.activecontrol.name

Krgrds,
Perry
 
G

Guest

I tried using the & to underline the respective letter that the user would
click as a shortcut key but when the application was deployed it didn't work.
So I figured it was like working in VB where you physicially had to assign
the shortcut key to a menu item before it would run. But I have seen it
before where you can assign mouse and key combination to active certain
functions on a form.
 
P

Perry

Try to hit ALT twice and see whether the underlinement (shortkey assignment)
kicks in.

Krgrds,
Perry
 
G

Guest

Use TAB key to move from field to field in the form. The fields and/or
command buttons that you have assigned shortcut keys, must have the focus for
the shortcut key to work.

Hope this helps.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top