Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Transfer Data from One Table to Another


View products that this article applies to.

Summary

To transfer data between two tables, you can create an additional field in one of the tables to store the common data, and then create an update query to accomplish the transfer.

↑ Back to the top


More information

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

This process can be illustrated using the sample database Northwind.mdb. The following example adds a ProductName field to the Order Details table, and then copies the ProductName field from the Products table based on the ProductID field.

NOTE: Typically, you do not duplicate the ProductName field because duplicate data does not indicate good database design.

To transfer data between two tables, follow these steps:

  1. Open the Order Details table in Design view.
  2. Add a ProductName field as a Text data type.
  3. Save and then close the table.
  4. Create a new query based on the Order Details and Products tables.NOTE: These tables are automatically joined on the ProductID field because a relationship has already been defined. If your tables are not joined, join them on the original linked field.

  5. On the Query menu, click Update Query.
  6. On the View menu, click Table Names. Drag the ProductName field from the Order Details table to the first cell in the Field row of the query grid.
  7. In the Update To row, type:
    [Products]![ProductName]
  8. On the Query menu, click Run. You receive a Microsoft Access message warning you that you are changing the data; click Yes.
  9. Look at the Order Details table. Note that all records in the Order Details table are updated with the Product Name from the Products table.
  10. Close the query without saving it.

↑ Back to the top


References

For more information about transferring data between two tables, click Microsoft Access Help on the Help menu, type update a table based on values in another table by using a query in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

↑ Back to the top


Keywords: KB209728, kbusage, kbinfo, kbhowto

↑ Back to the top

Article Info
Article ID : 209728
Revision : 2
Created on : 6/29/2004
Published on : 6/29/2004
Exists online : False
Views : 276