Tabbing into/out of subforms

  • Thread starter Thread starter Tara
  • Start date Start date
T

Tara

I posted on this issue yesterday and earlier today and
have gotten some great tips. However I'm still not
getting quite what I need. I have a form with several
subforms, only one of which I want to tab into from the
main form. I have figured out how to do this (thanks to
those who responed to my earlier posts!). However, if
there is data in the subform, I get locked into cycling
through the subform only. If the subform has no data,
then I can keep tabbing through it and back into the
first field on the main form. Also, when I tab back into
the main form, I would like it to move to the next
record, but instead it stays on the record I just
finished with. I'm not sure if what I want to do can be
done, but if so, I'm sure it will take some code. I'm
new with VB, so if anyone has suggestions please keep
this in mind. You'll have to be very explicit! Thanks
so much for any help!
 
However, if
there is data in the subform, I get locked into cycling
through the subform only.

If you type Ctrl-Tab it will tab out of the subform into the next
control in the tab order of the main form (which in your case would be
the next subform).

If you don't want your users to have to two-finger the operation, you
will indeed need some code:

- Put an unbound Textbox on the subform
- Put it LAST in the tab order for the subform
- Make it transparent and one pixel square, or hide it behind some
other control, so the user can't mouse into it, only tab
- In its GotFocus event put code like:

Private Sub txtJump_GotFocus()
Parent!secondsubform.SetFocus
Parent!secondsubform.Form!controlname.SetFocus
End Sub

to set focus first to the next subform, and then to the desired
control within that subform.
 
Back
Top