Solved

Create custom keyboard shortcuts

Posted on 2011-02-25
16
1,641 Views
Last Modified: 2012-05-11
Hello,

I'm using Access 2010 and I'd like to assign some keyboard shortcuts to certain build in features such as the align left button.  How can I do this in Access 2010?

Thanks
0
Comment
Question by:eshurak
  • 8
  • 6
  • 2
16 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34985503
you can create a macro and save it as AutoKeys

from  ribbon Create > macro

select submacro from the Add new action drop down
enter ^Q     '< just a sample, this for Ctrl + Q combination
 select Runcode
 in the function name enter  fAlignLeft()


save macro

now create a new module and place this codes

Function fAlignLeft()
docmd.runcommand accmdAlignLeft
end function


test by creating a form and adding textbox, select the textbox and hit CTRL + Q



0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 480 total points
ID: 34985569
correction, you can directly assign AlignLeft without using any function


SubMacro ^Q
    runcommand
        command AlignLeft

end submacro


0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 20 total points
ID: 34999026
For the record there are Hotkey combinations to do this.
For example: Alt+JASAL
...will left align all the selected controls as you specify.
In Design View, tap (press and release) the Alt key then press (and release) JASAL in sequence

Not terribly user friendly, but they do exist...

;-)

JeffCoachman
0
 
LVL 3

Author Comment

by:eshurak
ID: 35001770
Cap1 - I can't get this to work.  If I did would I have to do this in every database that I'm working with or it be made global?


Thanks Jeff, that works and because I added the align left to the QAT it's always the same.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35001867
< If I did would I have to do this in every database that I'm working with or it be made global?>
you have to include the AutoKeys macro for each db
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35002812
btw, where do you use the align left?
 for text in controls or aligning controls in the design view of the form?
0
 
LVL 3

Author Comment

by:eshurak
ID: 35003442
Cap,

I'm still not able to get this to work.  I can't see where find the runcommend is set or how to set the keyboard short cut.

Thanks
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35003447
what are you trying to set the alignment? see my post at http:#a35002812
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 3

Author Comment

by:eshurak
ID: 35003458
I'm attempting to align objects in a form.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35003468
upload a copy of your db..
 also, which key combination do you want to use for this function?  

 CTRL + < what key >
0
 
LVL 3

Author Comment

by:eshurak
ID: 35003484
I don't have a key combo in mind.  Could you just unload a blank db with the macro in it as the is no data involved so I can see the solution.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35003572
the solution is already posted at

http:#a34985503  and http:#a34985569
0
 
LVL 3

Author Comment

by:eshurak
ID: 35010631
Thanks Cap I see that you already posted it but neither runcommand nor alignleft exist.  There is a "RunMenuCommand", but there is no alignment option with that.  I can make it work with code but as I'm going to be moving this to many databases I rather have it all in one place as I'd like to make it work with just the macro and not code.

SubMacro ^Q
    runcommand
        command AlignLeft

end submacro
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 35010656
click on Show all actions from the ribbon.
0
 
LVL 3

Author Comment

by:eshurak
ID: 35010939
Awesome, great time saver.  Although I wish MS left customizing keyboard shortcuts the way it is in other apps.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35011092
Yeah, what odd is that in 2007 you had a complete "Alignment" tab, that you could just click to "nudge" the controls left, right, up or down.
It is gone in 2010...
:-(
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now