Avatar of Jarred Meyer
Jarred Meyer
Flag 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)

8/22/2022 - Mon
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

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

mx
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Private Sub btnDoIt_Click()

    SendKeys "{TAB}"   '  Tab
    SendKeys "+{TAB}"    ' Shift + Tab
 
End Sub
Jarred Meyer

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)
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Anthony Berenguel

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.
Jarred Meyer

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
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jarred Meyer

ASKER
Thanks a bunch! That's perfect!
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Anthony Berenguel

OH! Sorry, I misunderstood you request.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

You are welcome ...

mx