Set Focus on a TextBox and Set a Default Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have several text boxes on a form, each that I would like for their
corresponding button to become the default, so the user can use the 'Enter'
key to click the button.

I can think of different ways, like the 'got_focus' method, but thought I'd
first check. Is there is a really simple method to do this?
 
Sorry, you've lost me completely.

Text boxes do not have a "corresponding button". The only object which a
text box might have is an associated label. Text boxes and buttons are
entirely separate objects, with no connection between them - unless you
program one.

If a button has focus, the Enter key will cause its click event to be
triggered, and has the same effect as a mouse-click on the button.

Pressing the enter key in a textbox will cause the entry in that field to be
updated in its bound field in the form's recordsource, and will move to the
next control in the tab order of the section of the form in which the
textbox is located; if that control is a button, another Enter keystroke
will "click" that button; it will also not move from focus from that
button - additional Enter keystrokes will each "click" the button again.

What exactly are you trying to do?

Rob
 
Back
Top