Keyboard Short Cut

D

David Whitaker

Is there a way to;
When a specific form is open to assign any of the "F" keys to open another
specific form

For instance if;
say the form "list" was open and,
I wanted to open a form called "new" either by selecting,
a command button(which I can do) or,
press "F1" to open the form "new"
Now, is it possible to only use the F1 key(or any other key or combinations
of keys like Ctrl + N) explicitly(depending on the current open form) to
open an explicit form?
Hope this isn't confusing
David
 
B

Brendan Reynolds

Set the form's Key Preview property to 'Yes' (or True if you set it in code)
and then you can check the value of the KeyCode argument in the form's
KeyDown event procedure. Something like ...

Select Case KeyCode
Case vbKeyF1
DoCmd.OpenForm "YourFormName" etc. ...
Case Else
'whatever
End Select

Do consider carefully, though, before using the function keys for this kind
of thing. Most function keys have fairly consistent uses throughout
Microsoft Office, and users who are accustomed to those conventional uses
may be confused by departures from the standard.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

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