From: Peter Stone on
Novice, Access 2003, XP

I want to pass a control name to another application. The control is on a
subform, but I don't know the name of the main form because the subform is in
various mainforms.

E.g. fsubTxt contains txtBox1. How do I find the name of frmMain and then
pass the frmMain!fsubTxt.Form!txtBox1

Thank you
From: Jeanette Cunningham on
You can get the main form's name by using
Screen.ActiveForm.Name

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Peter Stone" <PeterStone(a)discussions.microsoft.com> wrote in message
news:20BA9DE7-0107-46CB-96F8-5917C348BB25(a)microsoft.com...
> Novice, Access 2003, XP
>
> I want to pass a control name to another application. The control is on a
> subform, but I don't know the name of the main form because the subform is
> in
> various mainforms.
>
> E.g. fsubTxt contains txtBox1. How do I find the name of frmMain and then
> pass the frmMain!fsubTxt.Form!txtBox1
>
> Thank you


From: Daryl S on
Peter -

You can reference the parent's name as follows:

[Parent].[Name]

--
Daryl S


"Peter Stone" wrote:

> Novice, Access 2003, XP
>
> I want to pass a control name to another application. The control is on a
> subform, but I don't know the name of the main form because the subform is in
> various mainforms.
>
> E.g. fsubTxt contains txtBox1. How do I find the name of frmMain and then
> pass the frmMain!fsubTxt.Form!txtBox1
>
> Thank you
From: Peter Stone on
Thank you

Just what I needed.

Can I pass a reference to the control like this?

Screen.ActiveForm.Name!fsubTxt1.Form!txtPub
From: Daryl S on
Peter -

I haven't needed to try this, but I think you can declare an object variable
and then set the object to be the control you want.

Dim objControl as object
objControl = Screen.ActiveForm.Name!fsubTxt1.Form!txtPub

Then you can pass the object.

Someone else may have done this?

--
Daryl S


"Peter Stone" wrote:

> Thank you
>
> Just what I needed.
>
> Can I pass a reference to the control like this?
>
> Screen.ActiveForm.Name!fsubTxt1.Form!txtPub