Question about main form with two subforms

  • Thread starter Thread starter Rose
  • Start date Start date
R

Rose

What would be the best approach to use for a form to track music volumes,
i.e.... a main form with a combo box to select a volume, a continuous form
to list all tracks for the volume and another subform to list all the
artists for the currently active track. My main form for selecting a volume
and the first subform for listing its tracks works great but I can't figure
out how to include a subform to list all the artists for the current track,
assuming the ability to scroll through the tracks. I would really appreciate
suggestions... Thanks
 
Hi Rose

Let's assume you have a one-to-many relationship between volumes and tracks,
and a many-to-many relationship between tracks and artists. This means that
you must have a joining table between tracks and artists (with a one-to-many
relationship in both directions). You can create a query based on your
artists table and the joining table which lists all the required artist
details and includes the track ID.

Now you can design another subform based on this query, displaying the
artist information. Add it onto your main form.

Next add a hidden (Visible=No) textbox to your main form named
txtCurrentTrack, and set its ControlSource to:
=[TrackSubformControlName].Form![NameOfTrackIDField]

Now set the LinkMasterFields of your artists subform control to
"txtCurrentTrack" and set LinkChildFields to the name of the field in your
query which is the track ID.
 
Thank You Graham! That worked perfectly... your explanation was clear and
very easy to follow. Thanks again :-)

Graham Mandeno said:
Hi Rose

Let's assume you have a one-to-many relationship between volumes and
tracks, and a many-to-many relationship between tracks and artists. This
means that you must have a joining table between tracks and artists (with
a one-to-many relationship in both directions). You can create a query
based on your artists table and the joining table which lists all the
required artist details and includes the track ID.

Now you can design another subform based on this query, displaying the
artist information. Add it onto your main form.

Next add a hidden (Visible=No) textbox to your main form named
txtCurrentTrack, and set its ControlSource to:
=[TrackSubformControlName].Form![NameOfTrackIDField]

Now set the LinkMasterFields of your artists subform control to
"txtCurrentTrack" and set LinkChildFields to the name of the field in your
query which is the track ID.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Rose said:
What would be the best approach to use for a form to track music volumes,
i.e.... a main form with a combo box to select a volume, a continuous
form to list all tracks for the volume and another subform to list all
the artists for the currently active track. My main form for selecting a
volume and the first subform for listing its tracks works great but I
can't figure out how to include a subform to list all the artists for the
current track, assuming the ability to scroll through the tracks. I would
really appreciate suggestions... Thanks
 
Back
Top