Many Subforms

D

DB

I have a main form with 2 subforms. The main form basically an individuals
name and minmal individual info.

One subform is a list of items belonging to the individual in the main
form.This form displays a couple fields - the item name and year in a
datasheet view. This form is linked to the main form.

The other subform is detailed info of the item in the other subform. What I
want to happen is when I look at the main form I want to see a list of items
belonging to the individual and be able to select from the item list and see
the detailed info to whatever item is clicked on.

All works well ie the main form is linked to the first subform and an item
list is displayed for each idividual record and the detailed info for the
first item in the list is displayed. But when I select on another item in the
list the detailed info does not change. In other words I need to link the
detailed subform to the list subform but I can not do this without messing up
the link between the main form and first subform.

Main form is master to first subform and first subform is master to
second(detailed info) subform. How can I complete the dual link or is there a
better way to accomplish this.

Thanks

DB
 
G

Graham Mandeno

Hi DB

On your main form, create a textbox with these properties:
Name: txtSubform2Link
ControlSource: =[Control containing Subform1].[Form]![Name of PK]
Visible: No

Now, for the control containing Subform 2:
LinkMasterFields: txtSubform2Link
LinkChildFields: NameOfPK

As you navigate to a different record in subform 1, the value in your hidden
textbox will be updated. This, in turn, will requery the linked Subform 2.
 
D

DB

Sorry to sound dumb but please clarify [Control containing Subform1] and
[Name of PK]

Thanks again for the help

Graham Mandeno said:
Hi DB

On your main form, create a textbox with these properties:
Name: txtSubform2Link
ControlSource: =[Control containing Subform1].[Form]![Name of PK]
Visible: No

Now, for the control containing Subform 2:
LinkMasterFields: txtSubform2Link
LinkChildFields: NameOfPK

As you navigate to a different record in subform 1, the value in your hidden
textbox will be updated. This, in turn, will requery the linked Subform 2.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

DB said:
I have a main form with 2 subforms. The main form basically an individuals
name and minmal individual info.

One subform is a list of items belonging to the individual in the main
form.This form displays a couple fields - the item name and year in a
datasheet view. This form is linked to the main form.

The other subform is detailed info of the item in the other subform. What
I
want to happen is when I look at the main form I want to see a list of
items
belonging to the individual and be able to select from the item list and
see
the detailed info to whatever item is clicked on.

All works well ie the main form is linked to the first subform and an item
list is displayed for each idividual record and the detailed info for the
first item in the list is displayed. But when I select on another item in
the
list the detailed info does not change. In other words I need to link the
detailed subform to the list subform but I can not do this without messing
up
the link between the main form and first subform.

Main form is master to first subform and first subform is master to
second(detailed info) subform. How can I complete the dual link or is
there a
better way to accomplish this.

Thanks

DB
 
G

Graham Mandeno

Hi DB

[Control containing Subform1]
When you place a subform on a main form, the actual form object (which you
see in the database window) is contained within a "subform control". This
subform control has its own set of properties such as position and size, and
also the following very important properties which control the way the
subform behaves:
SourceObject: the name of the form contained in the control
LinkMasterFields: the name of a control(s) on your main form that links
to the subform
LinkChildFields: the name of a field(s) in your subform's RecordSource
that matches the value in LinkMasterFields

The subform control might have the same name as the form it contains, but
often it does not. The difference between the two is often a source of
confusion.
So:
[Control containing Subform1] = [Name of the subform *control*]

[Name of PK] = [Name of the primary key field in subform1]
This is probably ItemID or some such.

I hope that's clearer now.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand



DB said:
Sorry to sound dumb but please clarify [Control containing Subform1] and
[Name of PK]

Thanks again for the help

Graham Mandeno said:
Hi DB

On your main form, create a textbox with these properties:
Name: txtSubform2Link
ControlSource: =[Control containing Subform1].[Form]![Name of PK]
Visible: No

Now, for the control containing Subform 2:
LinkMasterFields: txtSubform2Link
LinkChildFields: NameOfPK

As you navigate to a different record in subform 1, the value in your
hidden
textbox will be updated. This, in turn, will requery the linked Subform
2.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

DB said:
I have a main form with 2 subforms. The main form basically an
individuals
name and minmal individual info.

One subform is a list of items belonging to the individual in the main
form.This form displays a couple fields - the item name and year in a
datasheet view. This form is linked to the main form.

The other subform is detailed info of the item in the other subform.
What
I
want to happen is when I look at the main form I want to see a list of
items
belonging to the individual and be able to select from the item list
and
see
the detailed info to whatever item is clicked on.

All works well ie the main form is linked to the first subform and an
item
list is displayed for each idividual record and the detailed info for
the
first item in the list is displayed. But when I select on another item
in
the
list the detailed info does not change. In other words I need to link
the
detailed subform to the list subform but I can not do this without
messing
up
the link between the main form and first subform.

Main form is master to first subform and first subform is master to
second(detailed info) subform. How can I complete the dual link or is
there a
better way to accomplish this.

Thanks

DB
 
D

DB

When I put in your info the form goes blank when opened. I don't know if its
a name issue or structure issue.

Graham Mandeno said:
Hi DB

[Control containing Subform1]
When you place a subform on a main form, the actual form object (which you
see in the database window) is contained within a "subform control". This
subform control has its own set of properties such as position and size, and
also the following very important properties which control the way the
subform behaves:
SourceObject: the name of the form contained in the control
LinkMasterFields: the name of a control(s) on your main form that links
to the subform
LinkChildFields: the name of a field(s) in your subform's RecordSource
that matches the value in LinkMasterFields

The subform control might have the same name as the form it contains, but
often it does not. The difference between the two is often a source of
confusion.
So:
[Control containing Subform1] = [Name of the subform *control*]

[Name of PK] = [Name of the primary key field in subform1]
This is probably ItemID or some such.

I hope that's clearer now.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand



DB said:
Sorry to sound dumb but please clarify [Control containing Subform1] and
[Name of PK]

Thanks again for the help

Graham Mandeno said:
Hi DB

On your main form, create a textbox with these properties:
Name: txtSubform2Link
ControlSource: =[Control containing Subform1].[Form]![Name of PK]
Visible: No

Now, for the control containing Subform 2:
LinkMasterFields: txtSubform2Link
LinkChildFields: NameOfPK

As you navigate to a different record in subform 1, the value in your
hidden
textbox will be updated. This, in turn, will requery the linked Subform
2.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

I have a main form with 2 subforms. The main form basically an
individuals
name and minmal individual info.

One subform is a list of items belonging to the individual in the main
form.This form displays a couple fields - the item name and year in a
datasheet view. This form is linked to the main form.

The other subform is detailed info of the item in the other subform.
What
I
want to happen is when I look at the main form I want to see a list of
items
belonging to the individual and be able to select from the item list
and
see
the detailed info to whatever item is clicked on.

All works well ie the main form is linked to the first subform and an
item
list is displayed for each idividual record and the detailed info for
the
first item in the list is displayed. But when I select on another item
in
the
list the detailed info does not change. In other words I need to link
the
detailed subform to the list subform but I can not do this without
messing
up
the link between the main form and first subform.

Main form is master to first subform and first subform is master to
second(detailed info) subform. How can I complete the dual link or is
there a
better way to accomplish this.

Thanks

DB
 
G

Graham Mandeno

Hi DB

Are you sure that you changed the names in my example to the actual field
and control names in your own form?
--
Graham Mandeno [Access MVP]
Auckland, New Zealand

DB said:
When I put in your info the form goes blank when opened. I don't know if
its
a name issue or structure issue.

Graham Mandeno said:
Hi DB

[Control containing Subform1]
When you place a subform on a main form, the actual form object (which
you
see in the database window) is contained within a "subform control".
This
subform control has its own set of properties such as position and size,
and
also the following very important properties which control the way the
subform behaves:
SourceObject: the name of the form contained in the control
LinkMasterFields: the name of a control(s) on your main form that
links
to the subform
LinkChildFields: the name of a field(s) in your subform's
RecordSource
that matches the value in LinkMasterFields

The subform control might have the same name as the form it contains, but
often it does not. The difference between the two is often a source of
confusion.
So:
[Control containing Subform1] = [Name of the subform *control*]

[Name of PK] = [Name of the primary key field in subform1]
This is probably ItemID or some such.

I hope that's clearer now.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand



DB said:
Sorry to sound dumb but please clarify [Control containing Subform1]
and
[Name of PK]

Thanks again for the help

:

Hi DB

On your main form, create a textbox with these properties:
Name: txtSubform2Link
ControlSource: =[Control containing Subform1].[Form]![Name of PK]
Visible: No

Now, for the control containing Subform 2:
LinkMasterFields: txtSubform2Link
LinkChildFields: NameOfPK

As you navigate to a different record in subform 1, the value in your
hidden
textbox will be updated. This, in turn, will requery the linked
Subform
2.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

I have a main form with 2 subforms. The main form basically an
individuals
name and minmal individual info.

One subform is a list of items belonging to the individual in the
main
form.This form displays a couple fields - the item name and year in
a
datasheet view. This form is linked to the main form.

The other subform is detailed info of the item in the other subform.
What
I
want to happen is when I look at the main form I want to see a list
of
items
belonging to the individual and be able to select from the item list
and
see
the detailed info to whatever item is clicked on.

All works well ie the main form is linked to the first subform and
an
item
list is displayed for each idividual record and the detailed info
for
the
first item in the list is displayed. But when I select on another
item
in
the
list the detailed info does not change. In other words I need to
link
the
detailed subform to the list subform but I can not do this without
messing
up
the link between the main form and first subform.

Main form is master to first subform and first subform is master to
second(detailed info) subform. How can I complete the dual link or
is
there a
better way to accomplish this.

Thanks

DB
 

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