ACC: How to Update a Table Based on Values in a Second Table

Last reviewed: February 4, 1998
Article ID: Q93690
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SUMMARY

Novice: Requires knowledge of the user interface on single-user computers.

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.

MORE INFORMATION

This process can be illustrated using the sample database Northwind.mdb (or NWIND.MDB in Microsoft Access 1.x and 2.0). 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: In versions 1.x and 2.0, there is a space in the Product Name and Product ID fields.

NOTE: Typically, you would not duplicate the ProductName field because duplicate data is not 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 (or Update in Microsoft Access 7.0 and earlier).

  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. Note that all records in the Order Details table update with the Product Name from the Products table.

  9. Close the query without saving it.

REFERENCES

For more information about transferring data between two tables, search for "update queries, joined tables" using the Microsoft Access 97 Help Index.


Additional query words: link join transfer cascade
Keywords : QryMktbl kbusage kbfaq
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : x86
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 4, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.