Tab index from subfroms

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

Guest

I have a main form with three subforms.
Initially the tabs all work fine but after the first time the cursor enters
the subforms in the last field position ( ie two fields per record). The
cursor enters the fist record but in the second field. Do I set the tab index
on enter, exit, or ???? A little code could help since i'm relatively new !
Thanks
-- (e-mail address removed)
ericb
 
Eric B said:
I have a main form with three subforms.
Initially the tabs all work fine but after the first time the cursor
enters the subforms in the last field position ( ie two fields per
record). The cursor enters the fist record but in the second field.
Do I set the tab index on enter, exit, or ???? A little code could
help since i'm relatively new ! Thanks

Eric, I strongly suggest you not post your real e-mail addres in a
public newsgroup. Spambots and viruses scan newsgroup posts for address
to send their garbage to.

As for your problem, it arises because each subform maintains its own
"active control". You can force the focus to go to a particular control
whenever the subform is entered by writing an event procedure for the
Enter event of the subform control (on the main form) that displays the
subform. Here's an example:

'----- start of example code -----
Private Sub Subform1_Enter()

Me!Subform1!FirstControlOnSubform.SetFocus

End Sub
'----- end of example code -----

In the above, "Subform1" is the name of the subform control -- which is
not necessarily the same as the name of the form object that control
displays -- and "FirstControlOnSubform" is the name of the control on
that form object that you want to have the focus whenever the subform is
entered.
 
Back
Top