Solved

structuring tables that might link to each other?

Posted on 2004-04-25
4
199 Views
Last Modified: 2012-06-27
I have a database that includes two tables called, say, A and B.  Each record in table A can have multiple records in table B, but some of these sets of multiple records in table B can apply to more than one record in table A.  i.e. table A has 5 records, numbered A1 to A5.  Table B has 12 records numbered B1 to B12.  B1, B2 and B3, are all linked to A1; B4, B5 and B6 are linked to A2; and B7, B8 and B9 are linked to A3.  But B10, B11 and B12 apply equally to both A4 and A5.  There is no limit to the number of times a set of table B records can link to a single table A record.

In practical terms a user is required to select a table A record [in a form] and then add any number of table B records to it [in a sub-form].  But sometimes they don't want to enter multiple records twice, they just want to select a table A record, say A5, and rather than enter B13, B14 and B15 which are exactly the same as B10, B11 and B12 they just want to say "OK, I've selected A5, now I just want to tell the system that it should use the same table B records as A4".

What is the best way to structure / manage this in MS Access?
0
Comment
Question by:kiwibigdave
  • 2
4 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 250 total points
ID: 10913861
I sugeest that if you have'nt done so to read and understand the concept from the following
links.

Database Normalization Basics
http://support.microsoft.com/?kbid=209534

Defining Relationships Between Tables in a Microsoft Access Database
http://support.microsoft.com/?kbid=304467
0
 
LVL 54

Expert Comment

by:nico5038
ID: 10914025
For this you need a so-called "relation table" having the key of tableA and tableB.
The "set copy" can be performed by an INSERT query selecting the rows from say A5 and INSERT then with the key A4.

This will have to be triggered from the form and you need to decide what to do when A4 already has one or morerelation rows.....

Need more info ?

Nic;o)
0
 

Author Comment

by:kiwibigdave
ID: 10914054
Thanks for that capricorn, sometimes just asking the question and being pointed back at the basics makes you realise what you've done wrong.

But to update the topic for the future, immediately I saw the many-to-many topic at "Defining Relationships Between Tables in a Microsoft Access Database
http://support.microsoft.com/?kbid=304467 " I realised I don't have a many-to-many relationship at all, and that I'm actually one table short.

My table B needs to be split into B and C, with a one-to-many relationship from B to C.  Then B and A also need a one-to-many.

Thanks also Nico, if I had asked the right question I could have saved you some time.

Then again, if I'd known the right question I could have saved myself 250 points ;-)

0
 
LVL 54

Expert Comment

by:nico5038
ID: 10914076
Looks to me you realized you needed to created the relation table I proposed :-)

Nic;o)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now