How to link customer to postcode table

hullstorage

Registered User.
Local time
Today, 11:22
Joined
Jul 18, 2007
Messages
213
Hi all,

I am using access 2010 and have the following question?

I have 2 tables, 1 called UKFile and the other Customers with the following fields

[UKFILE] THIS IS WHERE ADDRESS DETAILS ARE STORED
POSTCODEID
POSTCODE
STREET
TOWN

[CUSTOMERS]
CUSTOMERNAME
POSTCODE
STREET
TOWN
CONTACTNAME
TELEPHONE

How do I link these so that when I enter the customers postcode it grabs the data from the UKFile table.

Should I change structure at this early stage, any suggestions.

Thanks
 
How do I link these so that when I enter the customers postcode it grabs the data from the UKFile table.
You don't. Let the infromation stay where they are, your tables need to be reshuffled a bit though..

tbl_UKFile
PostCodeID (PK)
PostCode
Street
Town

tbl_Customers
CustomerID (PK)
CustomerName
PostCode (FK)
ContactName
Telephone

The relationship between tbl_UKFile and tbl_Customers, would be One to Many, One postcode can have many customers. When you need to get this information, you only need to Marry the information using JOIN.
Code:
SELECT tbl_Customers.CustomerName, tbl_Customers.ContactName, tbl_Customers.Telephone, 
tbl_UKFile.Street, tbl_UKFile.Town, tbl_UKFile.PostCode
FROM tbl_Customers INNER JOIN tbl_UKFile ON tbl_Customers.PostCode = tbl_UKFile.PostCode;
 
sorry, what is join?
do I also need to create a query?
thanks for your help

simon
 

Users who are viewing this thread

Back
Top Bottom