The sample query below adds data from the Current Week table to the
records in the Yearly Rainfall table.
NOTE: This type of query does not work if the data being added is the result of a totaling or grouping.
To perform the query, follow these steps:
- Start Microsoft Access and create a new blank database.
- Create a new table with the following fields and data, and then save it as Yearly Rainfall:
Table: Yearly Rainfall
City Inches LastUpdated
-------------------------------
Baroda 0.5 4/2/2000
Basildon 22.0 4/2/2000
Beaver 18.0 4/2/2000
- Create a new table with the following fields and data, and then save it as Current Week:
Table: Current Week
City Inches WeekOf
--------------------------
Baroda 0.1 4/9/2000
Basildon 2.0 4/9/2000
Beaver 2.5 4/9/2000
- Create a new query based on the tables Yearly Rainfall and Current Week. Join the tables on the City field.
- On the Query menu, click Update Query.
- Drag the Last Updated and Inches fields from the Yearly Rainfall
table to the query grid.
- Create the following entries in the Update To row of the query
grid:
Field: Last Updated
Table: Yearly Rainfall
Update To: [Current Week].[WeekOf]
Field: Inches
Table: Yearly Rainfall
Update To: [Yearly Rainfall].[Inches]+[Current Week].[Inches]
- Save the query, and then run it.
The data in the table Yearly Rainfall is now as follows:
City Inches Last Updated
---------------------------------
Baroda 0.6 4/9/2000
Basildon 24.0 4/9/2000
Beaver 20.5 4/9/2000