# Access 2003 (or 2007) - Linking Foreign keys to Primary keys



## susieprice (Aug 30, 2008)

I am very new to Access and I can’t seem to get my head round look-up fields, relationships and queries. I have looked at several on-line tutorials that tell you how to do the individual things but not bring it all together. 

I have imported two tables from Excel one called County and one called Councils. (Each county has a number of councils in it). I have auto-generated a primary key in each table. Both tables have the field County in them. I have set up a one-to-many relationship between County in both tables and I have created a query that looks up the County:ID (primary key) for each County:County entered but then I’m really stuck. 

What I want to do is automatically display the County:ID as a foreign key in the Council table. Would you be able to give me any help on how I should go about this as I seem to be going round in circles. 

Thanks in advance of any assistance.

Susie


----------



## djaburg (May 15, 2008)

In lieu of setting up a "field" that displays that data, why not simply create a form for looking up the data you want and put the fields you want displayed in the form. For example you could create a form for looking up Council's and add the County:ID field to the display and since you have the relationship built in to the DB you'd see the correct ID. What I usually do when I create a DB for storing data I'll need to view frequently is create a main database page (a form) that opens each time I open the database and I create buttons that open up the different form types that I need to use (ie data entry, cross referencing, etc). Then all I have to do is click a button to get the data how I need to see it. It takes little time up front, but you'll save some time in the long run. I'm certainly no programmer by any stretch, but I was able to make several different databases to do things like manage a Christmas card list that contained check boxes for the years that we received cards from people. Just made it easier for the Mrs to be able to get what she needed without me having to make queries each time to get what I wanted. I even made buttons that would run a report to tell us when we didn't receive a card for 2 consecutive years so we could evaluate if we wanted to continue to send cards.


----------



## susieprice (Aug 30, 2008)

Thanks very much Djarburg, Ill give that a go. I think I just need to play around with it with the help of useful suggestions like yours.


----------

