Results 1 to 5 of 5
  1. #1
    MoooPleX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    2

    Displaying an entry value of one table, in another based on primary key.

    Hello. I'm new here, and this concept is a little hard for me to explain.. if clarification is needed, I'd be happy to do so.



    I have a 7 table database in Access 2007. I've listed primary keys of one table in another table in order to create a relationship between them. What I want to do is instead of having the table entry show a foreign key ("1","2","3".. ect), I want it to show a specific VALUE of a specific entry from another table, from the row denoted by the primary key.

    Example.. In the Orders table, instead of showing the FoodID as 1, 2 or 3.. I would like it to show: Chicken Dinner, Ham Omelet or Bacon Burger. The primary keys of which are: 1, 2 and 3 (in the Foods table).
    Last edited by MoooPleX; 03-20-2011 at 08:24 PM.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Create a query that joins the two tables on the Relationship field and display any field you want from either table.

  3. #3
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    In the table, you would show only the key value (i.e. 1,2,3). Relational databases work more efficiently with number fields rather than text. Additionally, all interaction with the data should be through forms, so generally the tables are hidden from the users in a database application.

    Do you have your relationships established between the tables via the relationship window? If so you can create queries that bring the info in the tables together. You can then base your forms on the queries or alternatively, you can base the forms on your tables and use combo boxes to display the related food name.

    This site has some tutorials that might be helpful in explaining how to use queries and forms to see related information.

  4. #4
    MoooPleX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    2
    Thanks for the help and speedy reply. I considered your solutions and searched a little more on the topic.

    As it turns out, I solved my problem by creating a lookup column with the lookup wizard.

    Just thought I'd post my findings for the googlers out there that might want to accomplish a similar task.

  5. #5
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    If you mean you have put lookups at the table level, you may want to look at this site. Lookups (combo and list boxes) are best left to forms.

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

Similar Threads

  1. Limit data entry based on another field
    By chemengr in forum Forms
    Replies: 5
    Last Post: 01-02-2014, 01:21 PM
  2. Create a new entry based on old one
    By Alexandre Cote in forum Programming
    Replies: 3
    Last Post: 10-17-2010, 05:45 PM
  3. Replies: 1
    Last Post: 09-02-2010, 03:59 PM
  4. table relations & primary key
    By mwabbe in forum Access
    Replies: 9
    Last Post: 08-19-2010, 10:09 AM
  5. Replies: 1
    Last Post: 10-26-2007, 07:29 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