On Sun, 16 Jan 2005 03:12:39 GMT, "Larry Linson" <bo*****@localhost.not>
wrote:
"Sally" <sm*****@notmyemail.com> wrote
Thanks for responding! That looks just
like what I am looking for.
Even simpler, for code executing in the module of the Form embedded in the
Subform Control... because the Subform has focus, Me.Name will return its
name.
Actually, Me is the name of the object containing the code that is running and
has nothing to do with the Active Control. "Me" will, however, always return
a reference to the subform object. It will not return a reference to the
suform control that -contains- that form.
It is possible to incontrovertibly determine the subform control on the parent
form that contains a given subform if you have a reference to the subform, and
it doesn't depend on active controls, etc. The way you do it is to cycle
through all the controls on the parent form, and for each subform control
found, compare the subform's .Form.Hwnd property to the original subform's
..Hwnd property. If 2 form references have the same .Hwnd property value, the
references are to the same form instance.