[ Team LiB ] Previous Section Next Section

Updating Query Results

If you haven't realized it yet, you can usually update the results of a query. This means that if you modify the data in the query output, Access permanently modifies the data in the tables underlying the query.

To see how this works, follow these steps:

  1. Build a query based on the Customers table.

  2. Add the CustomerID, CompanyName, Address, City, and Region fields to the query design grid and then run the query.

  3. Change the address of a particular customer and make a note of the customer ID of the customer whose address you changed. Make sure you move off the record so that Access writes the change to disk.

  4. Close the query, open the actual table in Datasheet view, and find the record whose address you modified. The change you made was written to the original table; this is because a query result is a dynamic set of records that maintains a link to the original data. This happens whether you're on a standalone machine or on a network.

graphics/clock_icon.gif

It's essential that you understand how Access updates query results; otherwise, you might mistakenly update table data without realizing you've done so. Updating multitable queries is covered later in this hour, in the sections "Pitfalls of Multitable Queries"and "AutoLookup in Multitable Queries."


    [ Team LiB ] Previous Section Next Section