On enter command

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.
 
W

Wayne Morgan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top