Avatar of Jeremy Campbell
Jeremy CampbellFlag for United States of America

asked on 

How to assign TAB or SHIFT+TAB to an access combo box on a form?

Anyidea what the vba would be to assign TAB or SHIFT+TAB to an access command button?

Thanks!
Microsoft Access

Avatar of undefined
Last Comment
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

SendKeys "{TAB}" and SendKeys "+{TAB}"

mx
Private Sub btnDoIt_Click()

    SendKeys "{TAB}"   '  Tab
    SendKeys "+{TAB}"    ' Shift + Tab
 
End Sub
Avatar of Jeremy Campbell

ASKER

Yup, that works but didn't think about the fact that by clicking on the button you are taking focus off of the current field.. Not sure how to work through that.

Anyideas how to keep it from losing focus on the current field in the form? (the reason I'm trying to do this is the form is being used on a touch device and I don't want to have to pull up the keyboard to move through the fields)
is there a reason why you want to use Tab or Crtl+Tab to access a command button? You could also assign an hotkey to the button which might be a little easier/cleaner. To do that simple put an ampersand (&) in front of the character that you want to be designated as the hotkey to access the button. For example, if you have a button called btn_Test, and the caption for the button is Test, and you want to access Test without clicking the button, all you need to do is put an ampersand (&) in front of one of the characters in the caption. So, in this example the property for caption would be '&Test' if you wanted T to be the hotkey. Then to access that button without clicking it, all you need to do is press Alt+T.
Avatar of Jeremy Campbell

ASKER

Not looking for a hotkey to get to a command button. Just want to make a commnd button activate a key combination.
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Jeremy Campbell

ASKER

Thanks a bunch! That's perfect!
OH! Sorry, I misunderstood you request.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo