Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2013
    Posts
    3

    Unanswered: Primary and foreign key question

    I am fairly new to access. I am building a database which has the potential for two buyers on a single transaction. I want to assign a primary key to each customer. Is it possible use the primary key of each customer within a single transaction and create a relationship.

    more simply:
    1 table holds transaction
    Transaction ID: Buyer 1 ID: Buyer 2 ID


    Buyers:
    Buyer ID First Last ...


    The transaction table will pull from the buyers and hold a 2-1 relationship

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    yes that a good plan

    but don't have spaces in your feild names they will bite in the ..... later

    A other tick

    make the PK the same name as the table

    Buyers:
    BuyersID
    Fname
    Surname
    ....
    ....

    Transaction
    TransactionID
    1BuyersID
    2BuyersID
    ....
    ....
    ....

    this is only to make it easyer when looking a Querys U can see What table the ID comes From.

    I always put my ID first in the Table
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    Feb 2013
    Posts
    3
    Thanks Myle,
    As a follow up. How could I also set a relationship in the transaction table so that buyer2 will also show the transaction in the the buyers table (upon hitting the plus button after setting up a table relationship) and not just buyer 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •