473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Keyboard Shortcuts to Execute Code?

twinnyfo
3,653 Expert Mod 2GB
Hey Friends,

MS Access 2010.

Does anyone know of a way to execute Code (or even a Macro) by using a Keyboard Shortcut? For example, if I have a block of Code (or a Macro) that were to check for new data updates (or ANYTHING--that is just a "fer example"), but I wanted to be able to execute it from anywhere within a Project (and at any time) by simply hitting, for example, Ctrl-Shift-Q.

I'm just exploring new ideas and possibilities, and this one came to mind as potentially being very useful for what I want to do.

Thank for all your hepp!
Apr 1 '15 #1

✓ answered by Seth Schrock

I just found out how. Create a macro called AutoKeys. Give it a submacro with the name of the submacro being your key combination (^ for Ctrl, + for Shift) and have its action be whatever you need. This is called AutoKeys if you want to google it. I got it to work with Ctrl + Q, but I couldn't get Ctrl + Shift + Q to work. You may have to play with that.

12 9292
Seth Schrock
2,965 Expert 2GB
I don't know of a way to set a program level keyboard shortcut like that, but you can use the KeyUp event on each form to call your code. Just set the form's Key Preview property to Yes and test for the key code combination.

Expand|Select|Wrap|Line Numbers
  1. If (Shift And acCtrlMask) > 0 And (Shift And acShiftMask) > ) And KeyCode = vbKeyQ Then
Apr 1 '15 #2
twinnyfo
3,653 Expert Mod 2GB
This assumes a Form is open and with the focus. It seems like a potential option. I'm looking for anytime the DB is opened, with no forms being open (i.e., if the Back End is opened), such that I could run code to take away Navigation Pane and override the ByPass Key, but, then still be allowed to reverse it, all using shortcut keys.

Hmmmmmmmmmmmmm..

Thanks, Seth!
Apr 1 '15 #3
Seth Schrock
2,965 Expert 2GB
I just found out how. Create a macro called AutoKeys. Give it a submacro with the name of the submacro being your key combination (^ for Ctrl, + for Shift) and have its action be whatever you need. This is called AutoKeys if you want to google it. I got it to work with Ctrl + Q, but I couldn't get Ctrl + Shift + Q to work. You may have to play with that.
Apr 1 '15 #4
Seth Schrock
2,965 Expert 2GB
Just got the Ctrl + Shift + Q key combination to work. Enter +^{Q} as the submacro name.
Apr 1 '15 #5
twinnyfo
3,653 Expert Mod 2GB
I'll play around with it a bit. Thanks for the info!
Apr 1 '15 #6
twinnyfo
3,653 Expert Mod 2GB
Seth,

You are absolutely THE MAN!!!! This is the coolest thing I've discovered yet. Now, when I want to protect my data files, I just run a shortcut key macro that removes the nav pane, disallows the bypass key and prevents all the menus, then I close the DB and VOILA!! To unlock it all, I just execute another shortcut key!

Yes, I am sure there are still ways to get around it, but most people will just simply get discouraged and walk away when all they see is an absolutely blank Access DB window.

Thanks so much, Seth! I'll put this into every DB I create from now on!
Apr 2 '15 #7
Seth Schrock
2,965 Expert 2GB
I might put it in my apps too, but as a user tool to open specific forms from anywhere. Thanks for making me think to look for an answer like that :)
Apr 2 '15 #8
NeoPa
32,556 Expert Mod 16PB
Nice catch Seth. AutoKeys (Run an Access macro by using a keyboard shortcut) macro it is.

NB. I typed this up the other day but never got to post it :-(
Apr 3 '15 #9
Seth Schrock
2,965 Expert 2GB
I read that article when I was looking into the topic. However, Access 2010 (and 2013 I think) are very different in how Macros are built, so that article didn't help me build the macro. I'll see if I can find what article I used.

Here is the link that told me how to do it: autokeys 2010
Apr 3 '15 #10
NeoPa
32,556 Expert Mod 16PB
I'm a little confused by that Seth. It may well be that the way to create macros is somewhat changed, but the explanation for what is required within the macro hasn't.

John Viescas (is very clever actually.) tells how to set up the macro originally and includes a couple of examples for specific keys, but only the other link gives a good reference of what to use to do what across the board. The details for that haven't changed for many versions as far as I can tell.
Apr 4 '15 #11
Seth Schrock
2,965 Expert 2GB
You are correct that what is required within the macro is the same, but the creation is very different and I couldn't get to the content stage with just what was in your link. Part of it is that it doesn't explain what it is trying to do, so I couldn't figure out how to do that in the new version.
Apr 6 '15 #12
NeoPa
32,556 Expert Mod 16PB
Well, both links are available now and you found your answer in the end so we're all good and well done :-)
Apr 6 '15 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Spartanicus | last post by:
Some use the kbd element (Example: <kbd>Ctrl</kbd>+<kbd>G</kbd>) to mark up keyboard shortcuts, but the spec defines kbd as: "Indicates *text* to be entered by the user." (emphasis mine). UA...
0
by: ekta | last post by:
How do we write the code for Keyboard shortcuts in asp.net(c#).Is it possible through javascript only or there is any method/property availaible (like Accesskey) in asp.net. Thanks
5
by: bob lambert | last post by:
Hi, I have a vb .net std 2002 windows form app and wanted to use keyboard shortcuts (& in text property input) It shows up on the design view, but when I build (in debug mode) and display the...
4
by: Helene Day | last post by:
Sorry, this could be a newby question... but how do we do the keyboard shortcuts in .NET buttonname.text = "&Click Me" Does not give the short cut Alt-C for the button. Helene
1
by: Henry | last post by:
I have a listBox on my form. When the listBox has focus I want to respond to certain keyboard shortcuts like Ctrl+A that is used to select all contents as in Word, but I want to apply this to the...
1
by: Erland | last post by:
Hello, I am using asp.net 2.0 and I want to add keyboard shortcuts to my application just like the shortcuts you see in GMAIL. I was wondering how can I do this in ASP.NET? Scenerio that would...
0
by: Zytan | last post by:
I cannot use & to implement a keyboard shortcut on a TabPage like I can on a Button. Is there a way to easily do this? Maybe TabPages aren't supposed to have keyboard shortcuts, but it would be...
331
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
1
by: Bob Alston | last post by:
Are there any keyboard shortcuts that you routinely disable in you apps, to avoid users getting wierd results or problems? If so, what are they? And what technique do you use to disable them? ...
1
by: Gilbert Tordeur | last post by:
Hello, Context = Web site with VB2008. Is it possible to define keyboard shortcuts on a webpage, to make it possible for the user to "click" on a button or a link, or to set the focus on a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.