How to create a Microsoft Access One to Many Relationship

Posted on 2009-02-17
Last Modified: 2013-11-29
I know I'm being silly, but I am completely stumped!  I have an Access database where I want to store manufacturers and their products.  I have two tables, the first (tblManufacturer) has three fields: an autonumber field which is the record ID (and Primary Key), a field for Manufacturer name and a Lookup field for the products they produce.  The second table (tblProduct) has three fields: an autonumber field which is the record ID (and Primary Key), a Lookup field which looks up the Manufacturer from the first table, and a product field.

What I want to do is look at a manufacturer in the Manufacturers table and click the lookup to see what products they produce.  Currently, when I do this, I get a list of ALL products in the Products table, regardless of their manufacturer.  I have tried everything I can think of and just about every combination of relationships, but I only ever get all records.  At the moment, I have a one to many relationship set between the ID field in the Manufacturers table and the Manufacturer field in the Product table set to include only those records where both fields match.

An example is: Manufacturer ACME has a record ID of 6 - In the lookup in the Products table, the record equals 6.  When I select the lookup in the Manufacturers table, I don't just see products relating to ACME, but I see all products, regardless of their manufacturer.

Please help!!
Question by:Alex3471
    LVL 28

    Expert Comment

    You can't have the Product in the Manufacturer's table as this will mean that 1 manufacturer can only product 1 product. If more than 1 Manufacturer can produce a product then you need to do a Many to Many relationship. This is done with 3 tables

    tblManufacturer: ManufacturerID as PK
    tblProducts: ProductID as PK
    tblManufacturerProducts: ManufacturerID and ProductID as joint PK

    Cheers, Andrew
    LVL 74

    Accepted Solution

    As TextReport stated.

    In the most basic sense your tables would look something like this:

    ManufacturerID (Primary Key)

    ProductID (Primary Key)
    ManufacturerID (Foreign Key)

    The should be related on ManufacturedID in the relationship window.

    If this is done, it will create little (+) symbol in the Manufatures table.
    Clicking the "+", will display all the products that that manufacture makes.

    You can then use the form wizard to create a main form/ subform
    Selecting a Manufacturer in the main form displays all the corresponding Products.

    Here is a sample.
    Examine it carefully.

    I am sure you can modify it to work in your Database.

    (But also as TextReport states, this gets a bit more complicated if one product can be made by more than 1 Manufacturer.)



    Author Closing Comment

    Perfect!!  Got me out of a dreadful hole!  Thank you.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
    The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

    760 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

    15 Experts available now in Live!

    Get 1:1 Help Now