First of all, the syntax you're using looks counterproductive, unless you
are actually trying to work with a control on your main form which has the
same name as the active control on the subform.
Second, I'm not sure why you need the index in the Controls collection, when
you can always refer to a control by its name instead of its index -
Me.Controls("MyControl") instead of Me.Controls(i).
However, if you really need to return that index, you could do it with a
function like this:
(WARNING: AIR CODE)
Public Function ControlIndex(ctl as Control) as long
Dim i as Integer
For i=0 to Me.Controls.Count-1
if me.Controls(i) is ctl then
ControlIndex=i
exit for
end if
next
End Function
HTH
> Hi,
>
[quoted text clipped - 12 lines]
>
> Thanks