How do I tab from subform to subform?

S

Stapes

Hi

I have a form Order Form, with subforms Customer Details and Order
Details. When the user uses the tab key, after the last field in
Customer Details, it goes on to the next customer details record. What
I want it to do is to go to the first field in the Order Details
section.
How can this be achieved?

Stapes
 
J

John W. Vinson

Hi

I have a form Order Form, with subforms Customer Details and Order
Details. When the user uses the tab key, after the last field in
Customer Details, it goes on to the next customer details record. What
I want it to do is to go to the first field in the Order Details
section.
How can this be achieved?

Stapes

The assumption is that you will be entering more than one record in the
subform. If that's not the case (or usually not the case), you can put an
additional textbox named txtRelay on the Customer Details subform. Make it
unbound, and last in the tab order; it must have its Visible property set to
true for it to get the focus, but you can make it tiny and/or hide it behind
some other control to avoid mouseclicking into it.

In its GotFocus event put code like

Private Sub txtRelay_GotFocus()
Parent!subOrderDetails.SetFocus
Parent!subOrderDetails.Form!controlname.SetFocus
End Sub

where subOrderDetails is the name of the Subform Control containing the Order
Details form object, and controlname is the name of the control on that form
which should first get the focus.

John W. Vinson [MVP]
 

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