Combining Two Tables

C

Chris

I have a table with some name and address information. I just recieved a
more updated table with this same information and I would like to update the
original table with this new information. I cant just replace the table as I
am using an autonumber as the PK and their are additional fields for other
companies in the main table that I can't lose. How can I do this?
 
J

Jeff Boyce

Chris

How do you know which "new" name/address info is a match for an "old" one
(i.e., the one that needs updating)? If your "old" records all have Primary
Keys, do your "new"/updated records also have an ID you can use to match?

Without some way of being certain you have a match, you really don't have a
way to "update" old records.

Once you have such a way to match, use an update query to update values.
Create a backup first, since updating changes the data!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

Chris

Jeff,

My "new" records have a field ID called Code and the "old" records have a
field ID called [Property Code]. These are both the same identification
field. I've tried an update query but I'm a little unsure of how it should
work. Can you help me out there?
 
J

Jeff Boyce

Chris

It will be a little difficult, so I'll recommend that you check Access HELP
for more details.

The generic idea is:
1. BACKUP!
2. Open a new query in design view
3. Add both tables
4. Connect the tables on their matching fields by dragging the field from
one table to the field that matches on the other table.
5. Add the fields you want to see (this is for confirmation) from their
respective tables
6. Run the query as a SELECT query (the default condition)
7. If you need to, modify the query to select only the records you want
updated ... but the selection criterion may be records that are in both
tables!
8. Click on the Toolbar button that lets you change the type of query...
change to an Update query.
9. Under the fields in Table1 that you want updated, in the Update row,
type in the name of the field in Table2 that contains the update value.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Chris said:
Jeff,

My "new" records have a field ID called Code and the "old" records have a
field ID called [Property Code]. These are both the same identification
field. I've tried an update query but I'm a little unsure of how it
should
work. Can you help me out there?

Jeff Boyce said:
Chris

How do you know which "new" name/address info is a match for an "old" one
(i.e., the one that needs updating)? If your "old" records all have
Primary
Keys, do your "new"/updated records also have an ID you can use to match?

Without some way of being certain you have a match, you really don't have
a
way to "update" old records.

Once you have such a way to match, use an update query to update values.
Create a backup first, since updating changes the data!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

Alan

Hi,

You may also try to write a small code snippet in VBA to combine the
data of the two tables.

Alan Chen
DataNumen, Inc. - World leader in data recovery technologies
Website: http://www.datanumen.com
Fax: +1-800-9917-FAX (US Toll-Free)
 
I

i_takeuti

Chris said:
I have a table with some name and address information. I just recieved a
more updated table with this same information and I would like to update
the
original table with this new information. I cant just replace the table
as I
am using an autonumber as the PK and their are additional fields for other
companies in the main table that I can't lose. How can I do this?
 
Top