Results 1 to 3 of 3
  1. #1
    rosscortb is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    52

    Help allocating Primary/Foreign Keys and Relationships

    Hello,

    Trying to get to grips with relational ship design. Please can you help me with tables design. I know one employee only lives at one address but if they move I want to record this. Also, one address may have one or more than one costs. I am struggling with the putting it so the address costs only go against the one address. Based on the attached can you indicate if I need to change primary keys etc. Thanks RossClick image for larger version. 

Name:	DB.JPG 
Views:	18 
Size:	50.0 KB 
ID:	21207

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    1. Change the name of your Address table ID field to AddressID (for clarity)
    2. Add a new field called EmployeeID (type long) to address table and link your Employee table to this field instead
    3. with the data you have, not sure why you need a separate table for costs - it could just be included in the address table. However if you want to record separate rents for different years, keeping it separate makes sense, but you need to add something else such as a 'rent from' date - and as with addresses, change ID to CostID and add an AddressID (type long) which links to the address table

  3. #3
    rosscortb is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    52
    Hi. Thanks for your help yesterday. Attached is where I am todayClick image for larger version. 

Name:	DB.JPG 
Views:	6 
Size:	67.0 KB 
ID:	21213

    I have created some forms. I have a Personal Details(Main form) and link to the address (linked Form), when i click it opens up with the right addresses against the right employee so that's fine. On the address form there is button that takes you to the Address Costs form and it opens up against the correct costs against the correct address so that's fine but when I add a new cost should the address ID not automatically populate, in the attached case the number 4. Hope this makes sense cheers Click image for larger version. 

Name:	db1.JPG 
Views:	6 
Size:	43.2 KB 
ID:	21215
    Ross

Please reply to this thread with any new information or opinions.

Similar Threads

  1. primary and foreign keys?
    By themebuddies in forum Access
    Replies: 1
    Last Post: 12-14-2014, 09:23 PM
  2. Replies: 11
    Last Post: 06-11-2012, 12:23 AM
  3. primary/foreign keys
    By st1300 in forum Database Design
    Replies: 38
    Last Post: 12-04-2011, 01:27 PM
  4. Primary and foreign key in relationships?
    By Fatbot in forum Access
    Replies: 1
    Last Post: 04-12-2011, 10:11 AM
  5. Primary/foreign keys + relationships
    By tripptofer in forum Database Design
    Replies: 0
    Last Post: 08-12-2009, 07:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums