On enter command

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I have two text boxes, one on the main form and one on
the subform. I want it so that when the user clicks the
enter button, or a similar button if that is not
possible, the other text box will become the selected box.
 
In the OnClick event of the button, set the focus to the control of your
choice. Going from the main form to the subform you'll actually need two
SetFocus statements, first to the form then the control. Also, you'll have
to get the syntax correct to go between the forms.

Example of code running on the main form refering to the subform:
Me.NameOfSubformControl.SetFocus
Me.NameOfSubformControl.Form.NameOfControl.SetFocus

Example of code running on the subform refering to the main form:
Me.Parent.NameOfControl.SetFocus
 
Back
Top