Submit Button To Respond To Tab Key

  • Thread starter Thread starter Carmen via AccessMonster.com
  • Start date Start date
C

Carmen via AccessMonster.com

Does anyone know how to tab to the submit button to make it work? Right now
I have to hit the enter key to enter data. But would like to be able to tab
to the button and have it respond like the enter key on the keyboard.

Thanks,
Carmen
 
If what you really want to do is complete the current record and move on to
the next, then set the Cycle property of the form to All Records, remove the
submit button, and just let the user tab past the last control on the form,
thus saving the current record and moving to a new record. You can even just
make the submit button the last control on the form, and when the user
presses Tab on that button, it will move to the next record automatically.

If you really need to have the Cycle property set to Current Record then set
the KeyPress event of the button to check for the Tab character and write
code to go to the next record or whatever it should do on [Enter].

Button1_KeyPress (KeyAscii as Integer)
If KeyAscii = 9 then 'tab character
[DoWhatever, such as go to new record]
End If

You could even cancel the tab by using SendKeys "{ESC 1}", then SendKeys
"{ENTER 1}" to replace the Tab with an Enter.
 
Back
Top