Linking two subforms in a subform

M

mattieflo

Hello,

I am trying to link two subforms that reside in one subform that resides on
a main form page.

mainform - frmContacts2
main subform- name: subfrmextensions1, source object: frmExtensions1
subform1 - name: subfrmEXT_FLS, source object: frmEXT_FLS
subform2 - name: subfrmEXTFLS, source object: frmEXTFLS

When trying to link the subform frmEXT_FLS and frmEXTFLS, the database does
not recognize it. Here's what I put in the properties in frmEXTFLS.

CHILD FIELDS: ID
MASTER FIELDS: forms!frmContacts2!subfrmExtensions!subEXT_FLS!ID

Does someone know what I did wrong here? Thanks!
 
M

Marshall Barton

mattieflo said:
Hello,

I am trying to link two subforms that reside in one subform that resides on
a main form page.

mainform - frmContacts2
main subform- name: subfrmextensions1, source object: frmExtensions1
subform1 - name: subfrmEXT_FLS, source object: frmEXT_FLS
subform2 - name: subfrmEXTFLS, source object: frmEXTFLS

When trying to link the subform frmEXT_FLS and frmEXTFLS, the database does
not recognize it. Here's what I put in the properties in frmEXTFLS.

CHILD FIELDS: ID
MASTER FIELDS: forms!frmContacts2!subfrmExtensions!subEXT_FLS!ID


The Link Master Fields property must be either a field in
the parent form's record source or a control on the parent
form.

To link to parallel subforms, add a text box named txtLink
to the form containing the subforms. Then use subform1's
Current event to set the text box to the ID field's value:
Parent.txtLink = Me.ID

Now you can set subform2's Link Master Fields property to
txtLink
 
M

mattieflo

Hi Marshall,

Thanks for your time. It is still prompting me for a value for :

forms!frmContacts2!subfrmExtensions1!subEXT_FLS!txtLink

This is what i'm putting in for the 2nd Subform.

I'm able to link these two forms(subEXT_FLS and subEXTFLS) when I'm editing
the main Subform(frmExtensions1). However, when I throw the main Subform into
the Main form(frmContacts2) this is when I start having problems. I kind of
suspect i'm writing that line wrong.
 
M

Marshall Barton

Where are you using that reference? The fact that you are
being prompted for that implies that you are using it in a
query, which, as far as I know at this point, has nothing to
do with linking the two subforms.

The solution I tried to explain just uses txtLink (all by
itself) in the Link Master property.
 
M

mattieflo

Ok I got it work.

Yes I was putting that in the link master field. It wasn't taking 'txtlink'
alone because it was buried in two layers of subforms.

When I made the following changes in the properties, it ended up linking:

Child: ID
Master: forms!frmContacts2!subFrmExtensions1!SubFLS!txtLink

Ended up doing what I needed to do. Thanks for your help Marshall.



Marshall Barton said:
Where are you using that reference? The fact that you are
being prompted for that implies that you are using it in a
query, which, as far as I know at this point, has nothing to
do with linking the two subforms.

The solution I tried to explain just uses txtLink (all by
itself) in the Link Master property.
--
Marsh
MVP [MS Access]

Thanks for your time. It is still prompting me for a value for :

forms!frmContacts2!subfrmExtensions1!subEXT_FLS!txtLink

This is what i'm putting in for the 2nd Subform.

I'm able to link these two forms(subEXT_FLS and subEXTFLS) when I'm editing
the main Subform(frmExtensions1). However, when I throw the main Subform into
the Main form(frmContacts2) this is when I start having problems. I kind of
suspect i'm writing that line wrong.
 
M

Marshall Barton

Golly, I have never tried that kind of thing and would have
guessed that it would not work. And when you had it with a
wrong name, you were prompted for the value??? That's
something I would defintely have said would not happen. THe
fact that you made it work (along with being prompted
before) opens up all kinds of new possibilities that I'll
need to find some time to explore. What version of Access
are you using?

It looks like you put the txtLink text box in SubFLS, when I
was trying to say it should be in FrmExtensions1.

How did you get the line of code in SubFLS's Current event
to work? Seems like you had to change the Parent part to
something else??
 
M

mattieflo

Hi Marshall,

I actually didn't need to put in code in the on current event. I just set
the link master field property in the 2nd subform to what I posted before and
it ended up linking properly.

I'm using Access 2003 for this.


Marshall Barton said:
Golly, I have never tried that kind of thing and would have
guessed that it would not work. And when you had it with a
wrong name, you were prompted for the value??? That's
something I would defintely have said would not happen. THe
fact that you made it work (along with being prompted
before) opens up all kinds of new possibilities that I'll
need to find some time to explore. What version of Access
are you using?

It looks like you put the txtLink text box in SubFLS, when I
was trying to say it should be in FrmExtensions1.

How did you get the line of code in SubFLS's Current event
to work? Seems like you had to change the Parent part to
something else??
--
Marsh
MVP [MS Access]

Yes I was putting that in the link master field. It wasn't taking 'txtlink'
alone because it was buried in two layers of subforms.

When I made the following changes in the properties, it ended up linking:

Child: ID
Master: forms!frmContacts2!subFrmExtensions1!SubFLS!txtLink

Ended up doing what I needed to do.
 
M

Marshall Barton

I am amazed. I am nearly certain that I tried that kind of
thing in some(?) earlier versions and it did not work.
Maybe this is some subtle new feature MS slipped in A2002 or
A2003 without telling anyone??

I'm glad you went down an odd(?) track and ended up at a
very interesting destination. Thanks for posting what you
got to work.
 
M

Minton M

I am amazed. I am nearly certain that I tried that kind of
thing in some(?) earlier versions and it did not work.
Maybe this is some subtle new feature MS slipped in A2002 or
A2003 without telling anyone??

I'm glad you went down an odd(?) track and ended up at a
very interesting destination. Thanks for posting what you
got to work.
--
Marsh
MVP [MSAccess]
I actually didn't need to put in code in the on current event. I just set
the link master field property in the 2nd subform to what I posted before and
it ended uplinkingproperly.
I'm usingAccess2003 for this.
"Marshall Barton" wrote:


Works beautifully for Access 2007 - thanks for the tip! I'm sure I
should be using nested subforms but my users are never going to
understand how that works.

-- James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top