Populate one table from another

  • Thread starter Thread starter Mary M
  • Start date Start date
M

Mary M

If you have a table with records that correspond to records on another db
how
can you combine them?

Example DB1 has 3 fields - Field1, Field2, CODE
DB2 has 2 Fields - CODE, DESCRIPTION


I would like to add a 4th field to DB1 and populate it with the
corresponding
description from DB2 based on matching CODE.

How can this be done?


Many thanks in advance.
 
Do you have a good reason for doing this? Normally you would just create a
query with both tables so you wouldn't need to store the description in DB1.

If you must do this, it would be important that CODE was the primary key
field in DB2. You could then create a simple update query based on both
tables.
 
Duane said:
Do you have a good reason for doing this? Normally you would just create a
query with both tables so you wouldn't need to store the description in DB1.

If you must do this, it would be important that CODE was the primary key
field in DB2. You could then create a simple update query based on both
tables.

.... and then, having updated [DB1], you can delete [DB2], since it is
then redundant (contains nothing that is not available in [DB1]).

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
 
hi Mary,

Simply add the new field to the definition of the table. Then run an update
query.

UPDATE DB1 INNER JOIN DB2 ON DB1.Code = DB2.CODE SET DB1.Description =
[DB2]![DESCRIPTION];

Click ! run on the query view and your table will be updated.

Kind regards,
 
Back
Top