shortest path to "link child fields" property

Hi

In FormOpen event of a subform I want to use the "linked child fields"
property of the "subform control" that contains the subform.

The only way I see this is:

for each ctl in subform.parent.form
    if ctl.controltype = acsufform then
        if subform.name = ctl.form.name then FOUND

Is there a shorter way to do this?

Riyaz

0
riyaz
5/9/2007 9:45:26 AM
access.forms 6864 articles. 2 followers. Follow

4 Replies
569 Views

Similar Articles

[PageSpeed] 18

How about Me.Parent.Form.<nameofsubformcontrol>?

Carl Rapson

<riyaz.mansoor@gmail.com> wrote in message 
news:1178703926.581738.244140@l77g2000hsb.googlegroups.com...
>
> Hi
>
> In FormOpen event of a subform I want to use the "linked child fields"
> property of the "subform control" that contains the subform.
>
> The only way I see this is:
>
> for each ctl in subform.parent.form
>    if ctl.controltype = acsufform then
>        if subform.name = ctl.form.name then FOUND
>
> Is there a shorter way to do this?
>
> Riyaz
> 


0
Carl
5/9/2007 3:30:12 PM
On May 9, 8:30 pm, "Carl Rapson" <mr.mxyzp...@newsgroups.nospam>
wrote:
> How about Me.Parent.Form.<nameofsubformcontrol>?
>

Sub form does not know the name of subformcontrol which contains it.
Hence my loop.

Specifically, I'm trying to write a general method that does. A
general method cannot have control names hardcoded.

A general method for a subform to get to the subformcontrol (that
contains the subform) in the parent form - is what i need. :(

Riyaz

0
riyaz
5/11/2007 4:34:06 AM
<riyaz.mansoor@gmail.com> wrote in message 
news:1178858046.719761.16220@e51g2000hsg.googlegroups.com...
> On May 9, 8:30 pm, "Carl Rapson" <mr.mxyzp...@newsgroups.nospam>
> wrote:
>> How about Me.Parent.Form.<nameofsubformcontrol>?
>>
>
> Sub form does not know the name of subformcontrol which contains it.
> Hence my loop.
>
> Specifically, I'm trying to write a general method that does. A
> general method cannot have control names hardcoded.
>
> A general method for a subform to get to the subformcontrol (that
> contains the subform) in the parent form - is what i need. :(
>
> Riyaz
>

The I guess your way would probably be better. The only problem I could see 
is if the parent form contains more than one subform. In that case, you'd 
probably have to look at the Source Object property of the subform control 
to see if it's the right one (surely each subform knows its own name).

Carl Rapson


0
Carl
5/11/2007 3:33:36 PM

This is exactly the code I had in the original post.

Thanks.
Riyaz

On May 11, 8:33 pm, "Carl Rapson" <mr.mxyzp...@newsgroups.nospam>
wrote:
> The I guess your way would probably be better. The only problem I could see
> is if the parent form contains more than one subform. In that case, you'd
> probably have to look at the Source Object property of the subform control
> to see if it's the right one (surely each subform knows its own name).
>
> Carl Rapson


0
riyaz
5/11/2007 6:03:44 PM
Reply:

Similar Artilces:

shortest path to "link child fields" property
Hi In FormOpen event of a subform I want to use the "linked child fields" property of the "subform control" that contains the subform. The only way I see this is: for each ctl in subform.parent.form if ctl.controltype = acsufform then if subform.name = ctl.form.name then FOUND Is there a shorter way to do this? Riyaz How about Me.Parent.Form.<nameofsubformcontrol>? Carl Rapson <riyaz.mansoor@gmail.com> wrote in message news:1178703926.581738.244140@l77g2000hsb.googlegroups.com... > > Hi > > In FormOpen event of a subform I want...

Link child fields & Link master fields
Link child fields Link master fields I'm use this code to link master form and sub form Me.subclient.LinkMasterFields = "Text6" Me.subclient.LinkChildFields = "text7" The code work correctly What I want I want to remove the link I'm use this code but not work Me.subclient.LinkMasterFields = "" Me.subclient.LinkChildFields = "" What happen No record will display in the subform client Is there any way to display all records after remove the link ...

Link child fields & Link master fields
Link child fields Link master fields I'm use this code to link master form and sub form Me.subclient.LinkMasterFields = "Text6" Me.subclient.LinkChildFields = "text7" The code work correctly What I want I want to remove the link I'm use this code but not work Me.subclient.LinkMasterFields = "" Me.subclient.LinkChildFields = "" What happen No record will display in the subform client Is there any way to display all records after remove the link > > What I want > > I want to remove the link I'm use this code but n...

A subform Link Child Fields, Link Master fields problem (newbie question)
THis is a very basic question, since I'm learning Access without a book, so don't read too much into it, and from my description I trust you understand where I'm going. This post is a repost of another thread that got rather long so I broke it into a new post. As you can see below, the issue is how to bring into your child subform a field that is not a migrated primary key (that is, is not a foreign key) from the parent form, so that this field can be bound to control (e.g. a text box) in the child subform, mainly so that the user of the subform has a visual clue (ie the field wi...