SubForms

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

Guest

I have two subforms on the main form. When the form is opened the cursor
appears in the first field of one of the subforms. What I would like is for
the cursor to appear in the first field of the other sub form and when the
entries for one record (row) is completed, the cursor will then go to the
first field of the other form.
Any help on how this can be achieved would be appreciated.
 
Changing the Tab Order of your two subform controls may achieve the first
part of your question.

To move focus after changing a record will require using events and VBA
code. In an AfterUpdate event for a field or the subform, you could set focus
to the other subform control.

Steve
 
Thanks for that Steve,

As I am a novice is it possible for you to advise how to change the order
and the code required in the Event for moving to a particular field. Sorry
to be a pain and thanks again
 
To set the Tab Order, open the form in Design view, and select Tab Order
from the View menu for a dialog that lets you set the desired tab order.

The code Steve's describing would be something like:

Private Sub Control1_AfterUpdate()

Me.Parent.Subform2.SetFocus
Me.Parent.Subform2.Control2.SetFocus

End Sub
 
Thanks for you advice Douglas.
When I go to Select Tab Order, I only have a Ctrl Tab visible. The Subforms
are not mentioned. What could be the problem here? One subform appears to be
under a Ctrl Tab and the other subform in the Form Header.

Also, the After Update event procedure, should the procedure contain both
lines in your example; For example, I have a field called DepositAmt and
when this is filled, I want the cursor to jump to the other subform to a new
record and the first field which is called TransactionDate. Does the Field
TransactionDate substitute for Parent in your example. Sorry to be so dumb!

And thanks
 
The tab order for subforms is set in the form that's being used as a
subform, not in the parent form.
 
Back
Top