Press enter in textbox and execute button function in VBA

前端 未结 5 882
春和景丽
春和景丽 2020-12-11 06:23

I have a login form to my database done in Access 2010 and using VBA code. I want to be able to press Enter on txtboxPassword and automatically execu

5条回答
  •  执念已碎
    2020-12-11 06:58

    The buttons in Access have a property called Default (on the Other property page). If you set it to Yes the form calls the button click event handler automatically, when you press Enter. No need for additional Key-event handling.

    There is also a Cancel property. If you set it to Yes for a button, the form activates it automatically when the user types the Esc-key. Very practical for Cancel buttons.

提交回复
热议问题