473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Many to many relationship and subform

Hi all,

I have a many to many relationship that I want to present in a
form/subform combination. The tables are Book, Book_Author_Link and
Author. The main form is based on the table Book. How do I link a
subform showing Author details of the related Authors for a Book? I can
create the two forms independently but am not able to link the forms.
Can someone help?

Thank you,
Vinayak

Nov 13 '05 #1
6 6878
You might want to reconsider your data structure. Check out the any of the
similar samples/templates in Access. For your setup, you only need two
tables, though you might want to add more for publishers, store/library,
category, etc.

tblBooks
BookID - primary key (autonumber?)
title
authorID - foreign key -linked to tblAuthors
price
ISDN
publisherID -foreign key -linked to tblPublisher
category -foreign key linked to tblCategory
etc.

tblAuthors
AuthorID - primary key
Lastname
Firstname
etc.
Use the subform wizard, and it will walk you through defining the necessary
links between your main form and related subform.
-Ed
"Vinayak" <vp******@columbus.rr.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi all,

I have a many to many relationship that I want to present in a
form/subform combination. The tables are Book, Book_Author_Link and
Author. The main form is based on the table Book. How do I link a
subform showing Author details of the related Authors for a Book? I can
create the two forms independently but am not able to link the forms.
Can someone help?

Thank you,
Vinayak

Nov 13 '05 #2
Tom
Hi:

I assume you are structured this way because there can be more than one
author to a book and an author can write more than one book...

One way to approach this is to create forms and subforms as follows
..Form frmAuthors with a subform frmAuthors_subBooks
..Form frmBooks with a subform frmBooks_subAuthors

A user looking for information on Authors can open the frmAuthors, see
all the information in tblAuthor and a list of all the books the author
has written in the subform.

A user looking for information on Books can open the frmBooks, see all
the information in tblBook and a list of all the authors of the book in
the subform.

Include buttons in each of the subform records to open the other main
form. For example, if looking at frmBooks and the user wants more
information on one of the authors, facilitate that by putting a button
on the frmBooks_subAuthors record that opens the frmAuthors to the
right author.

Good luck

Tom

Vinayak wrote:
Hi all,

I have a many to many relationship that I want to present in a
form/subform combination. The tables are Book, Book_Author_Link and
Author. The main form is based on the table Book. How do I link a
subform showing Author details of the related Authors for a Book? I can create the two forms independently but am not able to link the forms.
Can someone help?

Thank you,
Vinayak


Nov 13 '05 #3
Tom,
I see what you are saying. I am trying to do one of the combinations
you have described. I am trying to create frmBooks that has all
information in tblBook and list of related Authors by including a
subform. I want to know how to create a frmBooks main form including a
subfrmAuthors based on the three tables tblBooks, tblAuthors,
tblBooks_Authors_Link. The simplified schema is as follows:

tblBooks
BookID - primary key (autonumber)
title
price
ISBN

tblAuthors
AuthorID - primary key
Lastname
Firstname

tblBooksAuthorsLink
BookAuthorsLinkID - primary key
AuthorID
BookID

How does one configure the subfrmAuthors form to get the details from
tblAuthors table based on the Book record in main form i.e. frmBooks?
Thanks,
Vinayak

Nov 13 '05 #4
Oops, just after sending that post, I realized that some books can have more
than one author, so your table design is needed. The main-subform set would
be generally the same, though you'll need to use two different main forms to
get both perspectives.
-Ed

"Vinayak" <vp******@columbus.rr.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi all,

I have a many to many relationship that I want to present in a
form/subform combination. The tables are Book, Book_Author_Link and
Author. The main form is based on the table Book. How do I link a
subform showing Author details of the related Authors for a Book? I can
create the two forms independently but am not able to link the forms.
Can someone help?

Thank you,
Vinayak

Nov 13 '05 #5
Tom
Vinayak:

Make a query based on tblBooksAuthorsLink joined to tblBooks. Include
all the fields from the join table and the bookname from tblBooks.

Make a form based on that query including the button to open the
frmBooks. All you really need on the form is the bookname and the
button. The IDs need to be part of the data source, but not displayed.
This will become your subform.

Open the frmAuthors that you have already design and use the subform
tool to add the subform you just designed. Let the wizard create the
appropriate links.

Do similar to create the author subform on the books main form.

When you get this all set up you will likely find that the user will
make hash of everything by following a thread of information. For
example, somebody will look up a favorite book, see the author, open
the author form, look at the other books written, select one of those
and open. You will need to coordinate between the two main forms to
make sure its obvious which is active and to make sure you don't get
multiple instances of each form open simultaneously. I'd suggest
setting the visible property = false on the form that is being left.
Good luck
Tom

Nov 13 '05 #6
Tom,

Got it. I was missing the part of creating a query and basing the
subform on that query instead of basing it on the table.
Thanks a ton,
Vinayak

Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark Hargreaves | last post by:
Hopefully someone can help. I have two tables, namely master and postings: Fields include the following: master: staffno - int (11) primary key forename - varchar (20) surname - varchar...
3
by: Mikey | last post by:
Hi all. In the process of trying to figure this thing out, I've been doing the old "stand around in the store and read as much as possible before you look like a derelict" thing. This time, with...
1
by: ning | last post by:
It's easy to present "One - Many" relationship in XML, but how to present "Many - Many" relationship in XML?
1
by: Powell | last post by:
I have a requirement to return some information from a large number of xml files I have tried XSLT, which quickly gets overwhelmed. Found references to XQuery and it seems like it might work I...
2
by: Maggieanp22 | last post by:
I'm designing a db which stores client details but each client has multiple 'occasions'. For each occasion there is a section which has items purchased (there are sometimes none, sometimes...
2
by: Todd D. Levy | last post by:
I have a primary table (containing basic contact information) and a number of subsidiary tables (containing various additional information) for employees. Most of the subsidiary tables have a...
0
by: misscrf | last post by:
I have this normalized database, and I don't understand why setting up the forms is so hard for me. I have the main candidate entry form. This is to enter in candidates who apply for a job. I...
4
by: bobg.rjservices | last post by:
running access 2k; adp w/ linked tables to SQL server; I am absolutely stymied, and ticked off beyond belief - I can not believe how much time I've wasted trying to do something that should be...
2
by: The Frog | last post by:
Hello everyone, I am trying to find way of writing an SQL query that can produce missing record combinations across a many to many type setup in Access. The three tables used are as follows:...
0
by: fred.flintstone | last post by:
I get warnings in the windows event viewer every few seconds.. See below. Why is this ? Event Type: Warning Event Source: DB2-0 Event Category: None Event ID: 5 Date: 22/08/2007...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.