Keyboard Shortcut to increment a date field

johnkrytus

Registered User.
Local time
Today, 15:47
Joined
Mar 7, 2013
Messages
91
I've successfully created AutoKeys and added multiple Submacro's to call different actions.

What I'd like to do, but don't know how to write the vba for it, is to increment or decrement a date field while it is selected by using a keyboard shortcut (in this case the "+" and "-").

Any help would be much appreciated.
 
Thats perfect!! I love it.

I searched for "ascii key codes" to get the list. I'm using 61 for the "=" instead of "+" so I don't have to hit <shift>.

Thanks for the help!
 
Last edited:
This is a great piece of code but now it's got me thinking of all kinds of keyboard shortcuts.

I would love to be able to type an "w" to get the first day of the week and a "k" to get the last day of the week (month, year, etc). Can it be done? Please tell me yes.
 
Alan, I have a form where I would like the return key to be bound to the save and close button.
So I grabbed the Ascii code 13 and attached it to the KeyPress event of several suspect fields where one might be inclined to want to close the form.
Is there a simple way to do something more globally?

also, what does the " KeyAscii = 0 " do in your code?
 
Last edited:
Makes Access ignore the key since we've already done something.
 
The notes in the given say:
When any alphanumeric key is pressed, Access passes its ASCII value to your event procedure in the variable KeyAscii. The code examines this value, and acts only if the value is 43 (plus) or 45 (minus). It destroys the keystroke (so it is not displayed) by setting the value of KeyAscii to zero. The active control is then incremented or decremented.
 

Users who are viewing this thread

Back
Top Bottom