Fred Boer said:
[...] I'm not able to follow *all* of this; I'm stumped here:
However, you
have to ensure that when control enters the subform, neither of these
"transfer" controls has the focus. Otherwise you'll never be able to
get back into the subform.
Umm.. how could these "transfer" controls get the focus, since they
are, to put it technically, "really teeny"? Are you thinking that
someone might accidentally just happen to hit them when they click
into the subform?
No, not at all. But you must bear in mind that every form, if it has
any control capable of receiving the focus, has its own "active
control", as returned by the form's ActiveControl property. This is the
control that, *as far as the form is concerned*, has the focus. It may
not be the control that has the focus as far as the whole application is
concerned, but it has the focus *on this form*. This is true whether
the form is a main form or displayed in a subform. You'll probably have
noticed that if you click on a control (not the first in the tab order)
on a subform, then Ctrl+Tab out to the main form, move to a new record,
and then tab back into the subform, you end up back in the same control
you were in before. This demonstrates that the subform's "focus"
control is maintained separately from that of the main form.
So if you have one of these transfer controls on your subform, and on
its GotFocus event it transfers the focus dirrectly back to a control on
the main form, which control on the subform will have the focus if you
then shift the focus, by tabbing or clicking, onto the subform? You
guessed it: the transfer control! So what happens then? The focus is
kicked *back* out of the subform and back to the main form again.
Effectively, you can't get back into the subform. This is the problem I
was talking about.
You probably have to have the GotFocus
Just plain lost here...
You see, if you first change the subform's active control to some other
control, not one of the transfer controls, and only then send the focus
back to the main form, then the subform's active control won't be one of
the transfer controls. So when you next attempt to enter the subform
the focus won't go to a transfer control, and so you'll be able to get
in. Does that clarify it?