472,335 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,335 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 6820
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...
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...
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...
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...
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...
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...
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...
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...
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...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.