splitting up a table

T

triley01

Hello,

I have imported a list from Excel with 25K records. Each row has Name
information (FN,LN,Co,Address,) plus Payment information (TransDate, Amount,
GL) If a person paid more than once their Name information is repeated with
the new Payment information. So the list contains many duplicate name entries.


From this table I would like to create a Name table that stores each unique
person only once and links to a Payments table which shows one or more
payments that each Name record has given.

How in Access can I accomplish this? Thanks so much for your help. Tim
 
D

Dale Fye

Start out with a make table query. Select the fields FN, LN, Co, Address
and select the MakeTable query. It will ask for a table name, call it
tbl_People. In the query properties, select Unique Values, so the QUERY
looks like:

SELECT DISTINCT FN, LN, Co, Address
INTO tbl_People
FROM yourTable

Run the query to build tbl_People

Open tbl_People in design mode, and add a ID field, set to Autonumber
datatype. Access will immediately create numbers for the ID for each of the
unique FN, LN, Co, Address combinations. Close that table

Next, open the table that contains the names and payment info. Add a new
field to it PeopleID, and give it a long integer datatype (to match it up
with the datatype of the Autonumber field in the new table). Close that
table

Now, create a new update query that looks something like:

UPDATE yourTable as T INNER JOIN tbl_People as P
ON T.FN = P.FN
AND T.LN = P.LN
AND T.Co = P.Co
AND T.Address = P.Address
SET T.PeopleID = P.ID

Run this query.

At this point, you should have a PeopleID for each record in your original
table, and should be able to delete the LN, FN, Co, and Address columns from
that table.

HTH
Dale

SET yourTable.PeopleID = tbl_People.ID
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top